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