I have the following program. It needs to say the user's name, average and the
letter grade of each user. I don't know how to fix it so it gives the average
of all users. It only gives the average of the last user.
user=int(input("How many students?"))
Score1=[]
Score2=[]
Score3=[]
name=[]
for i in range (0, user):
name.insert(user, input("What is your name?"))
for i in range (0, user):
ExamGrades=['exam1','exam2','exam3']
Score1.append(float(input(str(name[i])+ ":What is your score on your first
exam?")))
Score2.append(float(input(str(name[i])+ ":What is your score on your second
exam?")))
Score3.append(float(input(str(name[i])+ ":What is your score on your third
exam?")))
def Average():
global average
global grade
for i in range (0, user):
for j in range(len(Score1)):
average=(Score1[j]+ Score2[j]+Score3[j])/3
if(average>=90):
grade = "A"
elif(average>=80 and average<90):
grade="B"
elif(average>=70 and average<80):
grade="C"
elif(average>=60 and average<70):
grade="D"
else:
grade = "F"
return average
finalAverage=[]
for i in range (0, user):
finalAverage.append(Average())
print(name[i]+ ":Your average is: "+str(finalAverage[i])+ ", which is " + grade)
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor