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