I'm very fresh to Python and am coding a simple text-based calculator that takes choice input and performs a simple arithmetic process depending on the input. My issue arises in this; regardless of whether I input 'Multiply' or 'Divide', the program is always returning to value of the addition function. Any ideas?
def main():
whichCalc()
print(finalNum)
def whichCalc():
choice = input("Please enter one of the following; "
"Add, Multiply or Divide: ")
if choice == 'Add' or 'add' or 'ADD':
addNum()
elif choice == 'Multiply' or 'multiply' or 'MULTIPLY':
multNum()
elif choice == 'Divide' or 'divide' or 'DIVIDE':
divNum()
else:
print('What?')
def addNum():
global finalNum
finalNum = (firstNum + secondNum)
return finalNum
def multNum():
global finalNum
finalNum = (firstNum * secondNum)
return finalNum
def divNum():
global finalNum
finalNum = (firstNum / secondNum)
return finalNum
firstNum = int(input('Enter the first number: '))
secondNum = int(input('Enter the second number: '))
main()
I've tried removing the 'or' syntax as well as shifting things around, I'm not sure as to why it's diehard on only using the 'addNum' function even when I'm not calling it.