0
What's the problem? Can u help me?
4 Respostas
+ 1
Endless loops are problematic on Sololearn, because there's no real runtime.
https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
Have you tried your program in a regular environment (on a pc with Python installed)?
+ 1
Although a while loop would probably be better, it's not true that restart will only happen once.
It is a recursive function: As long as the user chooses Yes, a new frame of main will be started.
+ 1
I do not see big problems in your code: just remember to put all the inputs at start of the program and on different lines.
For example:
1
2
No
or
3
4
Yes
5
5
Yes
4
7
No
0
He'll get the result by printing it out - as he does. You don't have to use a return value.
Also, if 'Yes', main will be called again. and if 'Yes' in there, main will again be called - and so on (recursion).
So where is main only executed once? Or do you mean, every of these calls runs once, since there is no loop?
The effect for the output is the same anyway, at least on the surface.
But the user is limited to, what was it, 993 calculations, then he'll get an error. 😅