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
Nina [5.8K]
2 years ago
13

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

l 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. 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. 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:
sergeinik [125]2 years ago
3 0

Answer:

// program in Python

# function to find grade

def grade(t_score):

   #grade A

   if t_score >=90:

       return 'A'

       #grade B

   elif t_score >=80 and t_score <90:

       return 'B'

   #grade C

   elif t_score >=70 and t_score <80:

       return 'C'

   #grade D

   elif t_score >=60 and t_score <70:

       return 'D'

   #grade F

   else:

       return 'F'

# function to find average score

def calc_average(test_score):

   #variable to find sum

   total = 0

   for i in range(len(test_score)):

       #calculate total score

       total = total + test_score[i]

   # find average

   return total/float(len(test_score))

#array to store score

test_score = []

#read name of student

name = input("Enter student's name: ")

for i in range(8):

   #read score

   t_score = int(input("Enter the score {}: ".format(i+1)))

   #add score to array

   test_score.append(t_score)

#call function to find Average

averageScore = calc_average(test_score)

#print name of Student

print("Student Name: ", name)

#print each Score

for i in range(len(test_score)):

   #print each Score and Grade

   print("Score: ",test_score[i], "Letter Grade: ",grade(test_score[i]))

# print Average Score

print("Average Score: ", averageScore)

Explanation:

Read name of student from user.Then read 8 test scores from user. Call the function grade() to find the grade of a test score.Call the function calc_average() to  find the average score of all test.Print each score and corresponding grade and print  average score.

Output:

Enter student's name: Sam                                                                                                  

Enter the score 1: 45                                                                                                      

Enter the score 2: 98                                                                                                      

Enter the score 3: 67                                                                                                      

Enter the score 4: 86                                                                                                      

Enter the score 5: 60                                                                                                      

Enter the score 6: 77                                                                                                      

Enter the score 7: 92                                                                                                      

Enter the score 8: 32                                                                                                      

Student Name:  Sam                                                                                                        

Score:  45 Letter Grade:  F                                                                                                

Score:  98 Letter Grade:  A                                                                                                

Score:  67 Letter Grade:  D                                                                                                

Score:  86 Letter Grade:  B                                                                                                

Score:  60 Letter Grade:  D                                                                                                

Score:  77 Letter Grade:  C                                                                                                

Score:  92 Letter Grade:  A                                                                                                

Score:  32 Letter Grade:  F                                                                                                

Average Score:  69.625  

You might be interested in
Downlad the file and write a program named Lab10b_Act2.py that does the following: Opens the CSV file for reading Reads the CSV
a_sh-v [17]
他們會不會是因為這樣就是說他們的問題,他們會會覺得委屈覺得我
5 0
2 years ago
You are going to write a program for Computer test which will read 10 multiple choice questions from a file, order them randomly
sweet-ann [11.9K]

Answer:

Code is too large , i attached a source file below and also a text file from where i get Questions

Explanation:

6 0
3 years ago
What is the answer to this question I am not sure?
aleksley [76]

Answer:

Light sensor

Explanation:

“Street Light that Glows on Detecting Vehicle Movement. Generally, street light controlling system is a simple concept which uses a transistor to turn ON in the night time and turn OFF during the day time. The entire process can be done by a using a sensor namely LDR (light dependent resistor).”

8 0
3 years ago
Read 2 more answers
Ano ang<br> rotasyon ng daigdig​
Degger [83]

Answer:  are you tying to ask a question

Explanation:

6 0
2 years ago
Read 2 more answers
ก
Harrizon [31]

Answer:

Rubies are used in electronics.

 

Please select the best answer from the choices provided

T

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Complete the following:_____
    9·1 answer
  • ____ deals with ensuring that data is protected against unauthorized access, and if the data are accessed by an authorized user,
    10·1 answer
  • _______________ is the term for the convergence of real-time and non-real-time communications services such as telephony, instan
    11·1 answer
  • WHERE WAS THE CHEESEBURGER INVENTED?
    9·1 answer
  • ____ are designed to be used with everyday objects, such as home appliances, gaming consoles, digital cameras, e-readers, digita
    12·1 answer
  • What does RFID use for wireless communication?<br> Infrared<br> IoT<br> Smart chip<br> Tag
    14·1 answer
  • (I WILL GIVE BRAINLIEST) Which steps will delete an appointment?
    8·1 answer
  • Overview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for
    7·1 answer
  • A good machine should have the mechanical advantage of......?​
    7·1 answer
  • Your development team is planning to host a development environment on the cloud. This consists of EC2 and RDS instances. This e
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!