Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def add(x, y):
- return x + y
- def subtract(x, y):
- return x - y
- mylist = []
- while True:
- print("Do you want to add or subtract? If you want to exit type exit.")
- choice = input("Enter choice(add/subtract): ")
- if choice == 'exit':
- break
- num1 = float(input("Enter first value: "))
- num2 = float(input("Enter second value: "))
- if choice == 'add':
- print(add(num1,num2))
- mylist.append("")
- elif choice == 'subtract':
- print(subtract(num1,num2))
- mylist.append("")
- else:
- print("Please only select add or subtract")
- continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement