[Tutor] Help
Sibylle Koczian
nulla.epistola at web.de
Wed Oct 7 10:26:23 EDT 2020
Am 07.10.2020 um 10:16 schrieb Alan Gauld via Tutor:
> On 07/10/2020 08:01, Donovan Fitch wrote:
>> 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)
>>
>
> BTW Your for loop is completely unnecessary. It just
> performs the exact same operation many times.
> grade never changes so max/min get set to the
> same value each time.
>
While the while loop is the classical case for for.
Sibylle
More information about the Tutor
mailing list