Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- y = 0
- x = 0
- z = 0
- def add(x,y):
- z = x+y
- return z
- def subtract(x,y):
- z = x-y
- return z
- def multiply(x,y):
- z = x*y
- return z
- def divide(x,y):
- z = x/y
- return z
- def power(x,y):
- z = x**y
- return z
- def root(x):
- z = x**0.5
- return z
- x = input("First number of operation")
- x = float(x)
- operations = input("What operation would you like to use? Your choices are: Add, Subtract, Multiply, Divide, Power, Root")
- operations = operations.lower()
- if operations == "root":
- ans = root(x)
- else:
- y = input("What is the second number of the operation?")
- y = float(y)
- if operations == "add":
- ans = add(x,y)
- if operations == "subtract":
- ans = subtract(x,y)
- if operations == "multiply":
- ans = multiply(x,y)
- if operations == "divide":
- ans = divide(x,y)
- if operations == "power":
- ans =power(x,y)
- print(ans)
Add Comment
Please, Sign In to add comment