Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __operators = ('+', '-', '/', '//', '*', '**', '%')
- def calculator():
- x = eval(input())
- operator = input()
- y = eval(input())
- #print(str(x) + operator + str(y))
- # your code here
- result = 0
- if operator == "+":
- result = x + y
- elif operator == "-":
- result = x - y
- elif operator == "/":
- result = x / y
- elif operator == "//":
- result = x // y
- elif operator == "**":
- result = x ** y
- elif operator == "*":
- result = x * y
- elif operator == "%":
- result = x % y
- print(result)
- if __name__ == "__main__":
- calculator()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement