Respuesta :
Answer:
#section 1
f_name = input('Enter First Name: ')
l_name = input('Enter last Name: ')
age = int(input('Enter age: '))
grades = []
#section 2
while True:
try:
g1 = int(input('Enter First Grade: '))
if (-1 < g1 < 101):
g2 = int(input('Enter Second Grade: '))
if (-1 < g2 < 101):
g3 = int(input('Enter Third Grade: '))
if (-1 < g3 < 101):
break
else:
raise
else:
raise
else:
raise
except:
print('Grades must be within the range 0 and 100 ')
#section 3
grades.append(g1)
grades.append(g2)
grades.append(g3)
average = round(sum(grades)/len(grades), 2)
def lettergrade(a):
letter = 'A'
if a < 60:
letter = 'F'
elif 61 < a < 70:
letter = 'D'
elif 69 < a < 80:
letter = 'C'
elif 81 < a < 90:
letter = 'B'
elif 91 < a < 101:
letter = 'A'
return letter
#section 4
print('\n ---------Result-------------\n\n')
print('{} {}'.format(f_name, l_name))
print(grades)
print(average)
print(lettergrade(average))
Explanation:
The programming language used is python.
#section 1
In this section the program prompts the user to enter its first name last, last name and age. An empty list is also created to hold the grades of the student.
#section 2
The program uses a WHILE loop, TRY and EXCEPT block with IF statements to check if the grades are within range, if the grades are out of range an error is raised and the except block tells the user that a wrong input has been entered, the while loop keeps running until it has collected values that are within the stipulated range before it breaks.
#section 3
In this section, all the scores collected appended to the grades list and the average is calculated.
A function is also created, that would evaluate the letter grade depending on the value that is passed to it.
#section 4
The results are printed to the screen
![Ver imagen jehonor](https://us-static.z-dn.net/files/d08/81d02f91151cc8c75c936b273be9befa.png)