I'm trying to create an program in python for a class and I can't figure out why I can't get the expected output. The program is to take user input values until a 'done' is entered, and then print the max and min of these values. It also has some error checking for valid input (number and not text).
largest = None
smallest = None
while True:
    inp = raw_input("Enter a number: ")
    if inp == "done" : 
        break
    try:
        num=float(inp)
    except:
        print "Invalid input"
        continue
    if inp>largest: 
        largest=inp
    if inp<smallest: 
        smallest=inp
print "Maximum is ", largest
print "Minimum is ", smallest
The loop breaks properly if 'done' is inserted. It doesn't fail if a text string is entered, but also doesn't print "Invalid input". I'm not asking for someone to solve my homework program, but to provide me with an explanation as to why I never get largest or smallest to be anything other than their original assignment of "None".
Thanks in advance.
 
     
     
     
     
     
     
    