Advertisement
dvdjaco

5.2

Feb 21st, 2012
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. # #!/usr/bin/python
  2. #
  3. # By dvdjaco
  4. # Exercise 5.2
  5. #
  6. # Write another program that prompts for a list of numbers as above and at the end
  7. # prints out both the maximum and minimum of the numbers instead of the average.
  8.  
  9. l = list()
  10.  
  11. while True:
  12.     num = (raw_input("Enter a number: "))
  13.     if num == 'done' : break
  14.     try:
  15.         l.append(float(num))       
  16.     except:
  17.         print "Invalid input"
  18.  
  19. print max(l), min(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement