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
DerKrebs [107]
3 years ago
5

Write a python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The n

ame will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. There are 12 students in the class.
Write the following functions in the program:
calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student
determine_grade - this function should accept a test score average as an argument and return a letter grade for the score based on the following grading scale:
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F

Computers and Technology
1 answer:
SashulF [63]3 years ago
5 0

Answer:

<em>The program doesn't make use of comments (See Explanation)</em>

<em>Also the source code is attached as image to enable you see the proper format and indexing of the source code</em>

<em>The program using python is as follows</em>

def calc_average(name):

   score = []

   sum = 0

   for j in range(8):

       inp = int(input("Test Score"+str(j+1)+": "))

       score.append(inp)

       sum = sum + inp

       if inp>=90 and inp<=100:

           print("A")

       elif inp>=80 and inp<90:

           print("B")

       elif inp>=70 and inp<80:

           print("C")

       elif inp>=60 and inp<70:

           print("D")

       else:

           print("F")

   avg = sum/8

   print("Result Details of "+name)

   print("Average Score: "+str(avg))

   return avg

def determine_grade(result):

   if float(result) >= 90.0 and float(result) <= 100.0:

       print("Letter Grade: A")

   elif float(result) >= 80.0 and float(result) <90.0:

       print("Letter Grade: B")

   elif float(result) >= 70.0 and float(result) < 80.0:

       print("Letter Grade: C")

   elif float(result) >= 60.0 and float(result) < 70.0:

       print("Letter Grade: D")

   else:

       print("Letter Grade: F")

   print(" ")

for i in range(2):

   name = input("Student Name: ")

   result = calc_average(name)

   determine_grade(result)

Explanation:

def calc_average(name):  -> Declares the function calc_average(name); It accepts local variable name from the main function

   score = []

-> Initialize an empty list to hold test scores

   sum = 0

-> Initialize sum of scores to 0

   for j in range(8):

-> Iterate from test score 1 to 8

       inp = int(input("Test Score"+str(j+1)+": "))

-> This line accepts test score from the user

       score.append(inp)

-> The user input is then saved in a lisy

       sum = sum + inp

-> Add test scores

The following lines determine the letter grade of each test score      

if inp>=90 and inp<=100:

           print("A")

<em>--- </em>

      else:

           print("F")

   avg = sum/8  -> Calculate average of the test score

The next two lines prints the name and average test score of the student

   print("Result Details of "+name)

   print("Average Score: "+str(avg))

   return avg

-> This line returns average to the main method

The following is the determine_grade method; it takes it parameter from the main method and it determines the letter grade depending on the calculated average

def determine_grade(result):

   if float(result) >= 90.0 and float(result) <= 100.0:

       print("Letter Grade: A")

   elif float(result) >= 80.0 and float(result) <90.0:

       print("Letter Grade: B")

   elif float(result) >= 70.0 and float(result) < 80.0:

       print("Letter Grade: C")

   elif float(result) >= 60.0 and float(result) < 70.0:

       print("Letter Grade: D")

   else:

       print("Letter Grade: F")

   print(" ")

for i in range(2):

-> This is the main method

   name = input("Student Name: ")  -> A local variable stores name of the student

   result = calc_average(name)  -> store average of scores in variable results

   determine_grade(result)-> Call the determine_grade function

You might be interested in
What does dram stand for?
Sati [7]
Dynamic random-access memory
4 0
3 years ago
Read 2 more answers
What is the value of the variable result after these lines of code are executed?
Marta_Voda [28]

Answer:

W

Explanation:

W

3 0
3 years ago
Read 2 more answers
If you want to refine your google search results by date, which option should you use?
VashaNatasha [74]
Advanced Search. It's able to filter out things.
8 0
3 years ago
A computer's hard disk drive holds 8 x 10^10 bytes of information. If Jill buys an extra memory stick that holds 5.1 X 10^8 byte
denis-greek [22]

Answer:

The computer will store 8.05 *10^10 bytes of information.

Explanation:

This is the same as saying that the computer will now have 80.51 Gigabytes ( 1gb = 1.000.000.000 bytes) of storage. In this case, the number is represented in its decimal form, and the previous one is displayed in Scientific Notation.

8 0
3 years ago
While investing an email issue, a support technician discovers no user can access their email accounts on the company’s email se
Paul [167]

Answer:

The answer is D Check workstations on Lan for APIPA configuration.

Explanation:

1)

While investing an email issue, a support technician discovers no user can access their email accounts on the company’s email server connected to the private LAN.

Pinging the email server form several workstations on the LAN results in 0% packet loss.

Check workstations on Lan for APIPA configuration next step the technician should take in troubleshooting the issue.

7 0
3 years ago
Read 2 more answers
Other questions:
  • For microsoft word tabs are very useful when you want to
    13·1 answer
  • Given that it takes 0.08 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track
    6·1 answer
  • The first step in creating photographs with good backgrounds is which of the following? Learning to see the background before ta
    11·2 answers
  • Count Uppercase, Lowercase, special character and numeric values
    9·2 answers
  • A type of specialty processor devoted exclusively to protecting your privacy.
    9·2 answers
  • Write an algorithm that receives a number from the user (you can store the number in a variable called N). Then the algorithm sh
    8·1 answer
  • ......... defines the path of the movement for an object.
    12·1 answer
  • Which of the following would be done outside of a control room?
    5·2 answers
  • I need an If else statement that sorts three numbers from a file from least to greatest
    12·1 answer
  • Write a program that allows the user to enter three separate strings: a city name, a state name, and a ZIP code.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!