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]
3 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]3 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
Which device uses radio waves? ceiling fan microwave oven air conditioner x-ray machine?
ankoles [38]

the answer is microwave oven


8 0
3 years ago
Solving Systems of Equations by Substitution <br> pdf
maks197457 [2]
Bro look on photo math cjjdjsj
8 0
3 years ago
Write the necessary preprocessor directive to enable the use of the stream manipulators like setw and setprecision Additional No
Ksenya-84 [330]

We would use  #include<iomainp> header file accordingly.

<h3>What is manipulator?</h3>

Helping functions known as manipulators can change the input/output stream. It simply affects the I/O stream using the insertion () and extraction (>>) operators, not the value of a variable.

Special functions known as manipulators can be used in an I/O statement to change a stream's format specifications.

Operators who format the data presentation are known as manipulators.The application should contain the file iomanip.h to access manipulators.The manipulators endl, ws, ends, and flush are those without arguments.

Setw (val), Setfill (c), Setprecision (val), Setbase (val), SetIOS Flags (flag), and ResetIOS Flags are examples of manipulators with arguments (m).

Two categories of manipulators are typically in use: Specified and Unspecified.

To know more about pre-processor, visit:-

brainly.com/question/13100703

#SPJ4

4 0
2 years ago
which of the following are used on cable trays to protect the cable insulation from direct sunlight? a. barrier strips b. solid
laila [671]
The answer is barrier strips
7 0
3 years ago
Write code to complete print_factorial()'s recursive case. sample output if user_val is 5: 5! = 5 * 4 * 3 * 2 * 1 = 120
maxonik [38]
```
#!/usr/local/bin/python3


import sys

def print_factorial( user_val ):
    if( user_val < 1 ):
        return( 1 )
    else:
        return( print_factorial( user_val - 1 ) * user_val )


if( __name__ == "__main__" ):
    if( len( sys.argv ) == 2 ):
        print( print_factorial( int ( sys.argv[ 1 ] ) ) )
    else:
        sys.stderr.write( "usage: %s <integer>\n" % sys.argv[ 0 ] )

    exit( 0 )
```

5 0
3 years ago
Other questions:
  • Which process refers to starting up a computer?
    15·2 answers
  • Why does the hp computer not have Bluetooth?
    6·1 answer
  • Which type of software is created and updated by a worldwide community of programmers and is available for​ free?
    14·1 answer
  • Can't find the right year for this. (Attachment)
    6·1 answer
  • This LEGENDARY character made a much-celebrated comeback in 2017. What was the name of the villain he faced in this epic tale?
    7·2 answers
  • create a function named dispAry. This function has 2 arguments, the first one is an integer array and second one is a integer to
    15·1 answer
  • Write a program that prompts the user to enter the number of integer numbers you need to enter, then ask user to enter these int
    5·1 answer
  • Which of the following is NOT a useful strategy when making an informed purchase ?
    7·1 answer
  • D. Chipboard
    14·1 answer
  • Which of the following is an example of effective nonverbal communication?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!