In: Computer Science
Write a program that uses Python List of strings to hold the five student names, a Python List of five characters to hold the five students’ letter grades, and a Python List of four floats to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input Validation: Do not accept test scores less than 0 or greater than 100.
names=[]
grades=[]
marks=[]
for i in range(5):
f=0
names.append(input("Enter students name:"))#read name of
student
temp=[]
while True:
print("Enter test scores:")
temp=[]
for j in range(4):#read 4 scorees
temp.append(int(input()))
if temp[-1]<0 or temp[-1]>100:#check if score is valid or
not
print("Enter valid scores")
f=1
break
if f==1:
f=0
continue
else:
marks.append(temp)
break
a=(sum(marks[-1])/len(marks[-1]))#get average of scores
print("Average test score is :",a)
if a>90:
grades.append("A")#based on average append grade to list
elif a>80:
grades.append("B")
elif a>70:
grades.append("C")
elif a>60:
grades.append("D")
elif a>50:
grades.append("E")
else:
grades.append("F")
for i in range(5):
print(names[i]," ",marks[i]," ",grades[i])#print names,marks
list,grade
Screenshots:
The screenshots are attached below for reference.
Please follow them for output and proper indentation.