Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #calculator
- symbol = ['+' , '-' , '*', '/']
- print("Simple Calculator")
- print(symbol)
- print(20*'-')
- while True:
- n1 = int(input("Enter number: "))
- symbol = input(
- "Enter symbol: ")
- n2 = int(input("Enter number: "))
- if symbol == '+':
- t = n1 + n2
- print (f"{n1} + {n2} = {t}")
- print()
- elif symbol == '-':
- t = n1 - n2
- print (f"{n1} - {n2} = {t}")
- print()
- elif symbol == '*':
- t = n1 * n2
- print (f"{n1} * {n2} = {t}")
- print()
- elif symbol == '/':
- t = n1 / n2
- print (f"{n1} / {n2} = {t}")
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement