+ 1

hey guys, what's wrong with this code. A calculator

print("My Python Calculator") while True : print("type ADD to perform addition") print("type SUBTRACT to perform subtraction") print("type MULTIPLY to perform multiplication") print("type DIVISION to perform division") print("type QUIT to perform to break program") user_input = input("Input type ") if user_input== "QUIT": break elif user_input == "ADD": first_number = float(input("enter first number")) second_number = float(input("enter second number")) total = first_number + second_number print(total) elif user_input == "SUBTRACT": first_number = float(input("enter first number")) second_number = float(input("enter second number")) total = first_number - second_number print(total) elif user_input== "MULTIPLY": first_number = float(input("enter first number")) second_number = float(input("enter second number")) total = first_number * second_number print(total) elif user_input=="DIVISION": first_number = float(input("enter first number")) second_number = float(input("enter second number")) total = first_number / second_number print(total) else : print("INVALID")

2nd Jun 2020, 7:45 PM
Abuke Victor
Abuke Victor - avatar
5 Answers
+ 3
What is the error you are getting? Because it looks right to me There are some indentation errors tho after elif and elif is not in one line with if statement
2nd Jun 2020, 7:53 PM
Abhay
Abhay - avatar
+ 3
Yup check that elif after if
2nd Jun 2020, 7:59 PM
Abhay
Abhay - avatar
0
It says 'IndentationError: unindent does not match any outer indentation level'
2nd Jun 2020, 7:57 PM
Abuke Victor
Abuke Victor - avatar
0
I can't find the error there
2nd Jun 2020, 8:00 PM
Abuke Victor
Abuke Victor - avatar