Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def interact():
- while True:
- try:
- user_input = int(input('Please input an integer:'))
- except ValueError:
- print('Please input only intergers')
- raise
- else:
- print('{} is {}.'.format(user_input, 'even' if user_input % 2 == 0 else 'odd'))
- finally:
- user_input = input('Do you want to play again? (y/N):')
- if user_input != 'y':
- print('Goodbye.')
- break
- interact()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement