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 technology concept uses computer resources from multiple locations to solve a common problem?​
umka2103 [35]

Answer:

Distributed memory systems

Distributed memory systems use multiple computers to solve a common problem, with computation distributed among the connected computers (nodes) and using message-passing to communicate between the nodes.

Explanation:

5 0
3 years ago
The term for an operator that may not evaluate one of its subexpressions is
Xelga [282]

Answer:

short-circuit

Explanation:

3 0
2 years ago
True or Flase<br><br> In C++, the body of a for loop may never run even once.
stiks02 [169]

Answer: True

Explanation: For loop is used in the C++ programming is defined as the statement that defines about the flow control .This loop works under some condition that is considered.

For loop is evaluated to execute for one time if the statement condition is true but there are also chances of no execution at all because of the incorrect condition. So, for loop might not run even once in that condition.Thus , the statement given is true.

3 0
3 years ago
The five major functional areas consist of the Command Staff as a whole and the four sections in the General Staff: Operations,
inn [45]

The five major functional areas consist of the Command Staff as a whole and the four sections in the General Staff: Operations, Planning, Logistics, and Finance and Administration. Of these, the planning section consists of resource unit, situation unit, demobilization unit, and the documentation unit.

<u>Explanation:</u>

The Resource unit looks after the allocation, analysis, and organization of resources.

The situation unit collects information about The status of a particular incident that takes place in an organization.

The Demobilization unit is responsible for preparing a demobilization plan. It is responsible for the safety of persons and machines in case of any incident.

The Documentation unit looks after all the documents and prepares them on time.

8 0
3 years ago
2 inventions revolutionized photography, what are they?
kotegsom [21]
1. George Eastman's film, which was used for early motion pictures,
2. Polaroids instant film, which after being removed from the camera would dry and reveal a picture.

I hope this helps, I had to research these :)
6 0
3 years ago
Other questions:
  • Fordham3 Hardware is known for its consensus buying center culture. Recognizing this corporate culture, someone attempting to se
    8·1 answer
  • Corinne would like to click on the link at the bottom of a Web page but she only sees the top portion of the page. She should __
    6·2 answers
  • "where is a cookie that is created during a web site visit​ stored?"
    9·1 answer
  • What are the properties of magnetic field​
    8·1 answer
  • laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of t
    11·1 answer
  • !WILL MARK BRAINLIEST!
    8·1 answer
  • Individual internet users connect to isps through a(n ________.
    11·1 answer
  • What does considering scale mean in science?
    15·1 answer
  • 4. In Drag and Drop method of Excel , to copy the data , you need to press __________ key while dragging the cells.
    7·1 answer
  • Which programming languages is best for game development? ​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!