OK:
option = 'Yes'
while True:
demand = input('What do you want to do: ')
print('Enter your two numbers...')
a = int(input('First Number= '))
b = int(input('Second Number= '))
c = 0
if demand == 'add':
c = a + b
elif demand == 'subtract':
c = a - b
elif demand == 'multiply':
c = a * b
elif demand == 'divide':
c = a / b
print('Answer= %s' %c)
option = input('Do you want to run agian?: ')
if option != 'Yes':
break
If you are using a loop, this means you don't have to repeat statements in every branch of if
. So we read the demand
, followed by the two numbers (since all operations require two numbers, there are no special things)