Please, tell me why it doesn't work :( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Please, tell me why it doesn't work :(

The link to the code, just simple quiz: https://code.sololearn.com/cdvyDM3xn5tz

15th Mar 2019, 11:25 PM
Julia B
Julia B - avatar
3 Answers
+ 5
I think the problem is the while loop. On sololearn it does not work to get user input in a while loop. You have to input all at the beginning and not step by step.
15th Mar 2019, 11:45 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
It works, just not on Sololearn, because we have no real runtime here. The code is sent to Sololearn, the input which you completely have to give at the start will be put in, code is run, we only see the output. Run this on your computer and it works just fine.
15th Mar 2019, 11:46 PM
HonFu
HonFu - avatar
+ 2
I have three recommendations: 1.) In Python you don't have to use parentheses around conditions, you can just write: if 5>4: #code 2.) Instead of phone != '' you can just write: if phone: #code A string is True unless it is of zero length. 3.) You don't have to concat strings in a print statement using +, you can also write: print('phone:', phone) And if it's two string literals, you can even do: print('Hello ' 'World') (It becomes one string automatically.)
15th Mar 2019, 11:57 PM
HonFu
HonFu - avatar