1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Olegator [25]
3 years ago
8

Python: Write a program that generates 8 random scores (between 0 and 100), store them in an array,

Computers and Technology
1 answer:
maksim [4K]3 years ago
6 0

Answer:

<em>The program written in python is as follows;</em>

<em>Note that the program makes use of function named checkbest</em>

<em>Lines written bold are comments and are used to replace the explanation section</em>

<em></em>

#Program starts here

#This line imports the random module into the program

import random

#This line defines the function checkbest, with 2 parameters

def checkbest(score,best):

     #The following if condition implements the condition as stated in the

     #program requirement

     if score >= best- 10:

           grade = "A"

     elif score >= best - 20:

           grade = "B"

     elif score>= best - 30:

           grade = "C"

     elif score >= best - 40:

           grade = "D"

     else:

           grade = "F"

     #This line returns the letter grade depending on the above

     #conditions

     return "Grade: "+grade

#The main method starts here

#This line declares an empty list

array = []

#This line iterates from 1 to 8

for i in range(1,9):

     #This line generates a random integer between 0 and 100 (inclusive)

     score = random.randint(0,100)

     #This line inserts the generated score in the list

     array.append(score)

#This line sorts the list in ascending order

array.sort()

#This line gets the best score

best = array[7]

#This line iterates through the elements of the list

for i in range(0,8):

     #This line prints the current score

     print("Score: "+str(array[i]))

     #This line calls the function to print the corresponding letter grade

     print(checkbest(array[i], best))

     #This line prints an empty line

     print(" ")

#The program ends here

You might be interested in
What level of system and network configuration is required for cui?
andrey2020 [161]

The level of system and network configuration is required for Cui will be "Moderate confidentiality".

  • The data that really should be safeguarded or disseminated under appropriate regulations, rules, and conservative government objectives or guidelines, would be considered as CUI.
  • The FISMA demands CUI Fundamental to somehow be safeguarded somewhere at the FISMA Conservative category and may even be labeled as CUI as well as regulated.

Thus the above answer is right.

Learn more:

brainly.com/question/14083709

4 0
2 years ago
What is the topic of the e-mail? what is the purpose of the e-mail?
const2013 [10]

Answer:

What email are you talking about?

7 0
2 years ago
Order the steps needed to design a relational database.
tia_tia [17]

Answer:

1. List the fields needed to gain information

2. Break down the date into smaller parts

3. identify the fields holding stored data

4.distribute the fields into tables by subject

5. identify the common fields for linking tables

Explanation:

edge 2021

5 0
3 years ago
What are the common operations performed on character strings?
monitta
<h3>Answer(:</h3>

•concatenation

• scanning

• substringing

• translation

• verification

<h3>if you want to remember means csstv;-)</h3>
7 0
1 year ago
8.9 code practice edhesive
nadezda [96]

Answer:

.

Explanation:

7 0
2 years ago
Other questions:
  • The analog signals that carry analog or digital data comprise composites built from combinations of simple sine waves.
    12·1 answer
  • 1.How does inertia affect a person who is not wearing a seatbelt during a collision?
    10·1 answer
  • Which of the following focuses on information related to disease identification, control, and prevention?
    10·1 answer
  • Items that are cut or copied are placed on the Clipboard.
    6·2 answers
  • 5 of 10
    7·1 answer
  • Choose and explain, step by step, one method of backing up student files either manually or using a cloud service.
    10·1 answer
  • The term ________ refers to the use of a single unifying device that handles media, Internet, entertainment, and phone needs. Gr
    8·1 answer
  • Your job is to choose a data structure to implement polynomials whose coefficients are positive integers, such as 17x^4+4x^3+0x^
    9·1 answer
  • What is the engine for<br> ?
    6·2 answers
  • A while loop should be used if you want the user to watch the same video three times.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!