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
Question 4 (2 points)
rodikova [14]

Answer:

Add the broadcast jump! code to the end of Scratch Cat's code.

Explanation:

If we broadcast the jump! code, then the Gobo will listen, and he will start jumping up and down. It looks like that he is not getting what Scratch Cat is saying, and if the message of Scratch Cat is broadcasted then Gobo will listen to what Scratch Cat is telling. Hence, the above option is the correct option.

6 0
3 years ago
Read 2 more answers
Do you think EA sports should add more tape jobs to the game? (Game is nhl22)
wariber [46]

Answer:

yes

Explanation:

7 0
1 year ago
During her presentation, Marie wanted more freedom to move about the room and interact with her audience. She can use _____.
S_A_V [24]

Answer:

The correct answer is:

"a laser pointer and a remote control"

Explanation:

Let us look at the options one by one.

notes pages and an LCD projector

When she is using these options, she cannot have the freedom to move as she has to operate the projector somehow.

laptop computer and a pointer

In this case she has to operate laptop so movement will be reduced.

<u>A laser pointer and remote control</u> will give her a lot of freedom to move as she can use the remote control to operate the slides and the pointer to point stuff ont the slides.

Hence,

The correct answer is:

"a laser pointer and a remote control"

5 0
2 years ago
What does the shell of an operating system do
Andre45 [30]

The OS shell allows access to the operating system services

8 0
2 years ago
Previous
KonstantinChe [14]

Answer: Internet service provider

Explanation:

5 0
3 years ago
Other questions:
  • The FaceSnap app has permission to use many devices on your smartphone, including the camera. A data privacy concern that arises
    6·1 answer
  • You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?
    10·2 answers
  • ALGUEM SABE COMO MUDA O NOME DE PERFIL!?!?!? SE SOUBER ME AJUDA!!
    14·1 answer
  • Write a class called Person that has two data members - the person's name and age. It should have an init method that takes two
    12·1 answer
  • What is a header row?
    8·1 answer
  • Hello my name is Phoenix I will like for you to friend me on Ro blox my user name is Jessiahcoleman and if u play BLOX fruits or
    13·1 answer
  • How many operations can a computer perform every second?
    13·1 answer
  • Why do I keep getting points if I haven't answered anything? I don't want points.
    12·1 answer
  • What is the decimal number 86 when written as a
    9·1 answer
  • After Daniel performed poorly on a test, his teacher advised him to do some self-reflection to figure out how he could get a bet
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!