Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import operator
- x = float(input())
- y = float(input())
- z = input()
- operations = {
- '+': operator.add,
- '-': operator.sub,
- '*': operator.mul,
- '*': operator.pow,
- '/': operator.truediv,
- '//': operator.floordiv
- }
- try:
- operation = operations[z]
- print(operation(x,y))
- except KeyError:
- print("unknown operation")
- except ZeroDivisionError:
- print("Деление на 0!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement