Answer:
test_grades = []
tryagain = 'y'
while tryagain.lower() == 'y':
grade = int(input("Grade: "))
test_grades.append(grade)
tryagain = input("Another Input: ")
sum_extra = 0
for i in test_grades:
if i > 100:
sum_extra = sum_extra + (i - 100)
print(sum_extra)
Step-by-step explanation:
This line initializes an empty list test_grade
test_grades = []
This line prepares the user for input
tryagain = 'y'
The following iteration is repeated until the user stops input
while tryagain.lower() == 'y':
This prompts the user for grade
grade = int(input("Grade: "))
This appends the grade to the list
test_grades.append(grade)
This asks if there is another grade to be input
tryagain = input("Another Input: ")
This initializes sum_extra to 0
sum_extra = 0
This iterates through test_grade
for i in test_grades:
The following if condition gets the grades greater than 100 and sums the extra credit
if i > 100:
sum_extra = sum_extra + (i - 100)
This prints the extra credit
print(sum_extra)