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