I wrote this code for an online course I am taking and you cant post code and get specific help there. I hope that someone here will help. Code -
largest = None
smallest = None
numI = 0
while True:
num = raw_input("Prompt you")
if num == "done":
break
try:
numI = int(num)
except:
print "Invalid input"
continue
if numI >= largest or numI < smallest:
if numI > largest:
largest = numI
else:
smallest = numI
print "Maximum is",largest
print "Minimum is",smallest
Why does it return "Minimum is None"? I tried with two If loops, an If and and Elif, and now this nested loop. No matter what I dont seem to reach setting of the minimum value.
Any help greatly appreciated.
(Code is turned in and rated, so you cant ruin that part :) )
Aucun commentaire:
Enregistrer un commentaire