Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Finger Exercise: The largest odd integer of 10 integers inputs
- # 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.
- print 'The largest odd integer number of 10 inputs'
- print ''
- count=0 # no. of inputs variable
- uicomp=0 # previous input value store variable
- while count<10:
- ui=int(raw_input('Please enter an integer number | ' + str(10-count) + ' remain: ')) #input countdown display
- if ui%2!=0 and ui>uicomp: # the current input is checked if he is both odd and larger than the previous.
- uicomp=ui # store variable rebind
- count+=1 # steration incremental
- if uicomp==0: # when no inputs are odd
- print 'None of your inputs was an odd integer.'
- else: #the last standing odd is printed
- print 'The largest odd integer input is ' +str(uicomp)+'.'
- # End of program.
Advertisement
Add Comment
Please, Sign In to add comment