Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. maximum = None
  2. minimum = None
  3.  
  4. while True:
  5. #enter the input
  6. inp = raw_input("Enter a number:")
  7.  
  8. #handle the edge cases
  9. if inp == "done" :
  10. break
  11. if len(inp) < 1 :
  12. break
  13.  
  14. #only accept good input
  15. try:
  16. num = int(inp)
  17. #print num
  18. except:
  19. print "Invalid input"
  20. continue
  21.  
  22. #do the work
  23. if num > maximum :
  24. max = num
  25. if num < minimum :
  26. min = num
  27. else:
  28. num
  29.  
  30. print "Maximum is", max
  31. print "Minimum is", min
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement