I am studying python and when I was codding a simple calculator i found this error. Regardless of the function I call, the operation always adds up. Someone can help-me?
The code:
class CalculadoraTerminal:
# Addition
def addition(add, to_add):
return add + to_add
# Subtraction
def subtraction(sub, to_sub):
return sub - to_sub
# Multiplication
def multiplication(multi, to_multi):
return multi * to_multi
# Division
def division(div, to_div):
return div / to_div
# Menu
menu = input("A - Addition \nS - Subtraction \nM - Multiplication \nD - Division \nSelect you operation:")
if "A" == menu or "a":
print(addition(int(input("Type the initial Number: ")), int(input("Type the number to add: "))))
if "S" == menu or "s":
print(subtraction(int(input("Type the initial number: ")), int(input("Type the number to subtract: "))))
if "M" == menu or "m":
print(multiplication(int(input("Type the initial number: ")), int(input("Type the number to multiply: "))))
if "D" == menu or "d":
print(division(int(input("Type the initial number: ")), int(input("Type the number to divide: "))))
Error example:
A - Addition S - Subtraction M - Multiplication D - Division Select you operation:d Type the initial Number: 20 Type the number to add: 2 22