+ 1
Can Someone fix this code?
It's like control structures > A simple calculator https://code.sololearn.com/cIvLVeGD140E/?ref=app
16 Respuestas
+ 5
Hoppip 4.8, When declaring variables, you only need '='. Just one equal mark. The proper declarations should be like this:
a = 2
b = 1
aa = (a + b)
bb = (a - b)
cc = (a * b)
dd = (a / b)
+ 3
the problem is the indentation. And since you remove the while loop, you also have to remove the break statement.
Check the code I provided and compare it to your code to see the difference. Indentation is important in Python.
+ 2
you need to indent your code properly. After else: there should a tab (spaces)
+ 2
Here's a working code:
https://code.sololearn.com/c6ziJ5pczOp4/?ref=app
Aside from what Ravi mentioned, you don't need the while loop in line 7. It causes an infinite loop. then you also have to remove the break statement.
+ 2
did you type in capital letters? . ADD is different from add.
+ 1
thank you
+ 1
you have to remove the while loop because it is causing an infinite loop.
+ 1
the code is working. the input shouldn't have quotation marks. it should be:
add
not
"add"
+ 1
I've tried Jonathan's code and everything work well. Just make sure to input add (lowercase).
0
Why it still doeasn't work?
0
ok, but it still doesn't work
0
but your code doesn't work, if I write "add" it print 'addUnknoun input'
0
it says that the 18 line has a problem, add is not definited
0
I wrote add, Add and ADD in user_input, but they are not definited
0
Of course it doesn't work. Look at your code
if user_input == "add":
0
I modified, but it still say "name add is not definited"