probiner

Finger Exercise: The largest odd integer of 10 integers inpu

Oct 11th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. ## Finger Exercise: The largest odd integer of 10 integers inputs
  2. # Each input value is checked for being both odd and bigger than the previous stored input value, and if so, it's value is stored replacing the previous.
  3.  
  4. print 'The largest odd integer number of 10 inputs'
  5. print ''
  6. count=0     # no. of inputs variable
  7. uicomp=0        # previous input value store variable
  8. while count<10:
  9.     ui=int(raw_input('Please enter an integer number | ' + str(10-count) + ' remain: '))       #input countdown display
  10.     if ui%2!=0 and ui>uicomp:   # the current input is checked if he is both odd and larger than the previous.
  11.         uicomp=ui   # store variable rebind
  12.     count+=1    # steration incremental
  13. if uicomp==0:   # when no inputs are odd
  14.     print 'None of your inputs was an odd integer.'
  15. else:   #the last standing odd is printed
  16.     print 'The largest odd integer input is ' +str(uicomp)+'.'
  17.  
  18. # End of program.
Advertisement
Add Comment
Please, Sign In to add comment