Question

# test average and grade python

Solution

Verified
Step 1
1 of 2

This is the code for a program that can calculate the test average and the grade for each student based on the score.

scores = [("John", 100), ("Mark", 50), ("Ellie", 80), ("Elvis", 40), ("Johny", 66)]

if percentage >= 90:
return 'A'
elif percentage >= 80:
return 'B'
elif percentage >= 65:
return 'C'
elif percentage >= 50:
return 'D'
else:
return 'F'

for score in scores:

average = sum(x for x in map(lambda s: s[1], scores)) / len(scores)
print(f"The average score is {average}")


## Recommended textbook solutions

#### Computer Organization and Design MIPS Edition: The Hardware/Software Interface

5th EditionISBN: 9780124077263 (3 more)David A. Patterson, John L. Hennessy
220 solutions

#### Fundamentals of Database Systems

7th EditionISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
687 solutions

#### Introduction to Algorithms

3rd EditionISBN: 9780262033848 (1 more)Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
726 solutions

#### Introduction to the Theory of Computation

3rd EditionISBN: 9781133187790 (1 more)Michael Sipser
389 solutions