[Tutor] Help

Donovan Fitch donovanfitch3 at gmail.com
Wed Oct 7 03:01:59 EDT 2020


Hi,
So the problem that I am facing is with finding the average of a list of
inputs that the user has provided. Here is my code:
max = 0
min = 100

totalNum = int(input("Please enter the total number of students: "))
student = 1
print("Grades should be between 0 and 100.")
while student <= totalNum:
    grade = int(input("Student {} grade: ".format(student)))
    student += 1

    for i in range(1, totalNum, 1):
        if grade > max:
            max = grade
        if grade < min:
            min = grade

print("Maximum grade: ", max)
print("Minimum grade: ", min)

It works perfectly with finding the max and min, however, I need to know
how to find the average of the grades.


More information about the Tutor mailing list