+ 2

whats wrong with my code?

https://code.sololearn.com/ck0l471qTj21 hi i was tring to build the canculeror acording to the instractions in the python cours. but it does not work and i dont know whats wrong with it

11th Apr 2018, 6:36 AM
Yosef
Yosef - avatar
5 Réponses
11th Apr 2018, 3:57 PM
Maninder $ingh
Maninder $ingh - avatar
+ 2
Hi i was trying to build a calculator according to the instructions in the python course. But it doesn’t work and I have no idea whats wrong with it. Sorry i can’t python so maybe this will help others to see...
11th Apr 2018, 6:46 AM
syul
syul - avatar
+ 2
First, align the intendation levels - Python is picky on that.
11th Apr 2018, 6:49 AM
Johannes
Johannes - avatar
+ 2
yes, the problem is with alignment elif user_input == "add": um1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) should be elif user_input == "add": um1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) or elif user_input == "add": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ")) (notice you made this typo as well of um1) look at the indentation, the above lines are from 12,13,14. also, no need of ... the ellipsis, ellipsis comes in consoles of online compilers or idle, maybe you wrote there and copied your code from there. just focus on the indentation and everything will be fine. Good Luck :) this was simple code, otherwise I myself have faced the problem while writing classes, the rule in writing Python is keep track of indentation
11th Apr 2018, 6:58 AM
Sandeep Chatterjee
+ 2
um1 - > num1 typo
11th Apr 2018, 7:04 AM
Johannes
Johannes - avatar