Advertisement
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.
- #
- count=0 # No. of inputs variable
- uicomp=0 # Previous input value store variable
- while count<10:
- ui=int(raw_input('Enter ten integer numbers | ' + 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 # Iteration incremental
- if uicomp==0: # when no inputs are odd
- print 'No odd integer was inputted.'
- else: #The last standing odd is printed
- print 'The largest odd integer that was inputted is ' +str(uicomp)+'.'
- #
- # End of program.
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement