Advertisement
themoosemind

Untitled

Nov 16th, 2014
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. You should write [PEP8][1] conformant code. See http://pep8online.com/ to check your code.
  2.  
  3. Try
  4.  
  5.     #!/usr/bin/env python
  6.  
  7.     numbers = []
  8.  
  9.     while True:
  10.         inp = raw_input("Enter a number: ")
  11.         if inp == 'done':
  12.             break
  13.         numbers.append(int(inp))
  14.         if len(inp) < 1:
  15.             print("hey")
  16.             break
  17.  
  18.         try:
  19.             num = float(inp)
  20.         except:
  21.             print("Invalid input")
  22.             continue
  23.  
  24.     if len(numbers) == 0:
  25.         print("No number entered")
  26.     else:
  27.         print("Maximum is %i" % max(numbers))
  28.         print("Minimum is %i" % min(numbers))
  29.  
  30.  
  31.   [1]: https://www.python.org/dev/peps/pep-0008
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement