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