+ 1

What could be wrong with this program running on here. Its my first from learning Python @Sololearn. Kindly help me check

Calculator https://code.sololearn.com/ciRiZ521j01l/?ref=app

26th May 2017, 7:53 PM
DAMILOLA ODEYEMI
DAMILOLA ODEYEMI - avatar
8 odpowiedzi
+ 11
The second important thing that you need to know is about the message you are likely to get here when running some codes: "Looks like your program needs multiple input" This is a problem with SoloLearn's compiler, it handles input in an awkward way, because it requires you to send the inputs that the program requires at once, before it even starts running. This happens for all programming languages here in Code Playground. The only correct interpreter here is the one for web (HTML, CSS and JavaScript) So, from now on, everytime that you run codes here and they require input, you will get that dialogue box asking you for those inputs, what you can do to run it properly is: write each input on ITS OWN LINE. This way, after running the code, the input statements will take them one by one, as if the user was inputting them. If you'd like to run your code properly, you could send all inputs at once and on their own lines, like this: add 1 2 quit Keep in mind that your code is a while loop so that's why I strongly suggest you to write "quit" as the last input because it breaks the loop, otherwise it will keep looping and show you a traceback error because it didn't find any more inputs.
27th May 2017, 12:43 AM
Pao
Pao - avatar
+ 12
Hi Damilola! The problem with your code is that it's full of "indentation errors" which means that Python reallly cares about tabs and spaces, if the indentation level is incorrect then the program won't run at all. For instance, writing this piece of code will throw an indentation error because there's a tab missing: if user_input == "add": print("The answer is: " + sum) This would be the correct way: if user_input == "add": print("The answer is: " + sum) Remember that your code is a while loop so everything has to be indented inside of it. Here, I fixed your code for you 😊: https://code.sololearn.com/cOFucsHM9nw8/?ref=app
27th May 2017, 12:28 AM
Pao
Pao - avatar
+ 2
if user_input == "quit": break indent - TAB should be used as above example
26th May 2017, 8:23 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 1
I think you forgot to add the indents, python see's code 'blocks' by looking at the indents.
26th May 2017, 7:57 PM
EagleEye
EagleEye - avatar
+ 1
@James, what do you do when it says "Looks like your program needs multiple input"
26th May 2017, 10:02 PM
DAMILOLA ODEYEMI
DAMILOLA ODEYEMI - avatar
+ 1
@Paola, thanks very much for your contribution
27th May 2017, 12:09 PM
DAMILOLA ODEYEMI
DAMILOLA ODEYEMI - avatar
0
Thanks for your contribution
26th May 2017, 9:51 PM
DAMILOLA ODEYEMI
DAMILOLA ODEYEMI - avatar
0
I tested run the same program on my PC using the py shell and it worked. I just wonder why it won't work on here
26th May 2017, 9:52 PM
DAMILOLA ODEYEMI
DAMILOLA ODEYEMI - avatar