+ 12
Why does the calculator not function?
5 Respostas
+ 4
No, I didn't. Look at the indentation. In the first code, I used 4 spaces at the beginning of lines 2 and 4. In the second code, I used random indentation. This is exactly what is wrong with your code. If you look at lines 12 and 16, the elif statements are at different indentation levels. Everything needs to be properly aligned.
Yay:
if a == b:
____print(b)
____a += 5
elif b != 17:
____pass
Nay:
if a == b:
__print(b)
____a += 5
_elif b != 17:
_____pass
+ 3
Which calculator?
+ 3
Because if u mean this one:
https://code.sololearn.com/cA7TEOn87bVM/?ref=app
It does work. Input in the CP is a bit complicated. Each Input should be a new line, all taken at the beginning.
+ 3
So I guess this is the code you're talking about:
https://code.sololearn.com/cNztNFkpdu59/?ref=app
Make sure to use the same indentation levels throughout the entire code.
This works:
if a == b:
do_this()
else:
do_that()
This doesn't work:
if a == b:
do_this()
else:
do_that()
+ 2
You wrote the same code twice (if a == b:....)