I am trying to do this program that asks the user to input and you select the minimum and maximum of the numbers you put in the problem is it does find the maximum but the minimum shows up as None, any help on this? I just want to understand why None is lower than the numbers I type isn't None suppose to mean that the variable doesn't have any value until num is replaced by the user? thanks.
smallest = None
largest = None
while True:
num = raw_input('Enter the values: ')
if num == 'done' : break
if len(num) < 1 : break
try:
num = int(num)
except:
print 'Invalid input'
continue
if num is None or smallest > num :
smallest = num
if num is None or num > largest :
largest = num
print 'Maximum is',largest
print 'Minimum is',smallest
Python comparisons between different types aren't particularly meaningful. Instead of using None as your sentinel, use a large or small number: