Advertisement
Guest User

Max negative

a guest
Sep 2nd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. print('Enter integer numbers, enter [.] to end sequence')
  2. max_negative = -1000000
  3. x = raw_input('-> ')
  4. # if '.' or another symbol is inputed in the beginning
  5. while x == '.' or x.isalpha() or x.isspace():
  6.     x = raw_input('Enter number \n')
  7. if int(x) < 0:
  8.     max_negative = int(x)
  9. while x != '.':
  10.     x = raw_input('-> ')
  11.     if not x.isdigit() and not x.isalpha() and not x.isspace():
  12.         x = int(x)
  13.         if x < 0 and x > max_negative:
  14.             max_negative = x
  15. print('Largest negative number is ' + str(max_negative))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement