Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def add(a, b):
- print(a, "+", b)
- return a + b
- def substract(a, b):
- print(a, "-", b)
- return a - b
- def divide(a, b):
- print(a, ":", b)
- return a / b
- def multiplication(a, b):
- print(a, "*", b)
- return a * b
- def increase(a, b):
- print(a, "^", b)
- return a ** b
- operacja = {'1':add, '2':substract, '3':divide, '4':multiplication, '5':increase}
- print("Enter first number!")
- a = float(input("First number = "))
- b = float(input("Second Number = "))
- print("You entered:", a, " and ", b)
- print("::Menu::")
- print("1 - Add")
- print("2 - Substract")
- print("3 - Divide")
- print("4 - Multipy")
- print("5 - Increase")
- print("6 - Exit")
- wybor = input('What math operation?:')
- if wybor == '6':
- exit("You left the program!")
- print("Your Solution is: ", operacja[wybor](a, b))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement