Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # largest_and_smallest.py
- largest = 0
- smallest = 0
- while True:
- num = raw_input("Enter a number: ")
- if num == "done" : break
- while True:
- try: # isolate expected catching, helps find other areas to debug
- num = int(num) # instead of... num = num(type)
- except:
- print "Invalid entry"
- break
- if num >= largest : largest = num
- if num <= smallest : smallest = num
- print "Maximum is", largest
- print "Minimum is", smallest
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement