Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- first = int(input())
- second = int(input())
- operation = input()
- output = ''
- if operation == '+':
- result = first + second
- output = f'{first} + {second} = {result}'
- if result % 2 == 0:
- output += ' - even'
- else:
- output += ' - odd'
- elif operation == '-':
- result = first - second
- output = f'{first} - {second} = {result}'
- if result % 2 == 0:
- output += ' - even'
- else:
- output += ' - odd'
- elif operation == '*':
- result = first * second
- output = f'{first} * {second} = {result}'
- if result % 2 == 0:
- output += ' - even'
- else:
- output += ' - odd'
- elif operation == '/':
- if second == 0:
- output = f'Cannot divide {first} by zero'
- else:
- result = first / second
- output = f'{first} / {second} = {result:.2f}'
- elif operation == '%':
- if second == 0:
- output = f'Cannot divide {first} by zero'
- else:
- result = first % second
- output = f'{first} % {second} = {result}'
- print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement