+ 4
Please, tell me why it doesn't work :(
The link to the code, just simple quiz: https://code.sololearn.com/cdvyDM3xn5tz
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.
+ 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.
+ 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.)