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
Type the correct answer in the box. In which phishing technique are URLs of the spoofed organization misspelled? _____ is a phis
vodka [1.7K]

Answer:

Link manipulation

Explanation:

With the link manipulation the phisher manipulate the URL link, in this case, the URL can seem similar to an original website, but this link sends you to a fake website, and you enter for example your bank or personal information, the phisher use this data to steal money or delicate data, sometimes these links are sent by email or text messages.

4 0
4 years ago
material systems developer typically combines the skills of a programmer with the multitasking expectations of a .
SpyIntel [72]

Explanation:

Material systems developer typically combines the skills of a programmer with the multitasking expectations of developing 3 dimensional models of objects, enhancing the graphical effects.

The programmer simply does not have to translate the image but he needs to map the objects in some different ways that give it a 3D look. The object is composed of from material instead of simple modeling

8 0
3 years ago
Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline.
Brilliant_brown [7]

Answer:

Explanation:

The following code was written in Java and modifies the code so that for the given input such as 3 it outputs the exact information shown in the sample output.

import java.util.Scanner;

class CallPersonInfo {

   public static void main(String [] args) {

       Scanner scnr = new Scanner(System.in);

       PersonInfo person1 = new PersonInfo();

       int personsKid;

       System.out.println("How many kids do you have:");

       personsKid = scnr.nextInt();

       person1.setNumKids(personsKid);

       /* Your solution goes here */

       System.out.println("Kids: " + person1.getNumKids());

       person1.incNumKids();

       System.out.println("New Baby, kids now: " + person1.getNumKids());

   }

}

class PersonInfo {

   private int numKids;

   public void setNumKids(int setPersonsKids) {

       numKids = setPersonsKids;

   }

   public void incNumKids() {

       numKids = numKids + 1;

   }

   public int getNumKids() {

       return numKids;

   }

}

4 0
3 years ago
What is the numeric range of a 16-bit twos complement value? A 16-bit excess notation value? A 16-bit unsigned binary value?
blagie [28]

Answer:

twos complement value is (-2^15 -1) -32768 to 32767.

excess notation value is -32768 to 32767.

unsigned binary value is (2^16) 0 to 65535

Explanation:

Excess notation: used to represent signed integers. Always uses fixed number of bits with leftmost representing the sign.

Twos complement notation: As opposed to excess notation, a sign bit of 0 is used to represent the non-negative (+) sign and a 1 for the negative (-); again, zero is included in the non-negative set.

Unsigned Binary values: are binary values/bits that don't have signs

7 0
4 years ago
With the Linux operating system, it’s open source design means it can be used, modified and _____ freely.
vlada-n [284]

I believe the answer would be "shared". Just like with open source software, people can modify it, use it, and share the modifications made to the software. I hope this helps!

5 0
3 years ago
Read 2 more answers
Other questions:
  • 1.using synonyms can help make ur writing more________
    11·1 answer
  • What format are a setups program file in before executed?
    12·1 answer
  • All of the following are benefits of automation except
    5·1 answer
  • 1. Define what grasslands are ?
    14·2 answers
  • if anyone could help me with this it would be great. I have to turn in a practice resume and im completely lost and have no clue
    7·1 answer
  • Which of the following is one of the tools in REPL.it that helps prevent syntax errors?
    10·1 answer
  • Julio receives many emails from a healthcare site. He finds them useful, and he wants to save them all in a folder. How can he a
    12·1 answer
  • Choose the words that make the following sentence true.<br> Primary memory is
    5·1 answer
  • Which of the following situations is least likely fair use
    6·2 answers
  • 1. The opportunity to create several equations for launching program files is called
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!