I've just started with python and I'm not too great at learning where the problems lie. I have this calculator code which I am trying to create from scratch, however I've run into a small problem.
def Addition():
print('Addition: What are your numbers?')
a = int(input('First Number:'))
b = int(input('Second Number:'))
print('Your Answer is:', a + b)
def Subtraction():
print('Subtraction: What are your numbers?')
c = int(input('First Number:'))
d = int(input('Second Number:'))
print('Your Answer is:', c - d)
def Multiplication():
print('Multiplication: What are your numbers?')
e = int(input('First Number:'))
f = int(input('Second Number:'))
print('Your Answer is:', e * f)
def Division():
print('Division: What are your numbers?')
g = int(input('First Number:'))
h = int(input('Second Number:'))
print('Your Answer is:', g / h)
x = 'test'
def Question():
x = input('What would you like to do? (Add, Subtract, Divide, Multiply or Quit)')
while x == 'Add' or 'add' or 'A' or 'a':
x = 'test123'
print(Addition())
x = 'test'
while x == 'Divide' or 'Div' or 'D' or 'divide' or 'div':
x = 'test'
print(Division())
x = 'test'
while x == 'Multiply' or 'Mul' or 'Mult' or 'multiply' or 'mult' or 'Times' or 'times':
x = 'test'
print(Multiplication())
x = 'test'
while x == 'Subtract' or 'Take Away' or 'Take away' or 'take Away' or 'take away':
x = 'test'
print(Subtraction())
x = 'test'
while x == 'Quit' or 'exit' or 'quit' or 'Exit':
x = 'test'
print(exit())
while x == 'test':
print(Question())
while x == 'test':
print(Question())
When i run the code it decides that Addition() is what it wants to run after asking me the question, no matter the input. Is this because I have defined it first, or for some other reason? Also, I don't want to use anyone elses code, but is there a simpler way to do this? Any help is greatly appreciated!
Thank you everyone for the help!