Skip to content

Instantly share code, notes, and snippets.

@tombrad
Created February 15, 2013 16:22
Show Gist options
  • Save tombrad/4961459 to your computer and use it in GitHub Desktop.
Save tombrad/4961459 to your computer and use it in GitHub Desktop.
Max and min initializing with None
max = None
min= None
while True:
num = raw_input("Enter a number: ")
if num == "done" : break
if len(num)<1 : break
try:
num = float(num)
except :
print "Invalid input"
continue
if num > max or max == None:
max= num
if num < min or min == None:
min = num
print "Maximum is", max
print "Minimum is", min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment