You are on page 1of 1

# Take first number from user as float

firstnum = float(input('Enter first number please\n'))


# Choose math function
print('Choose what you want to do')
print('1 add, 2 subtract, 3 multiply, 4 divide')
# Assign choice to variable mathmagic
mathmagic = input('Enter choice 1, 2, 3, 4\n')
# Take second number from user as float
secnum = float(input('Enter the second number please\n'))
# Placeholder for final answer
answer = 0
# If/Elif loop to decide what math operation to use
if mathmagic == '1':
answer = firstnum + secnum
elif mathmagic == '2':
answer = firstnum - secnum
elif mathmagic == '3':
answer = firstnum * secnum
elif mathmagic == '4':
answer = firstnum / secnum
else:
answer = 'That is not allowed try again'
# Display your final answer
print(answer)

You might also like