23rd Oct 2019, 9:50 PM
MR Jey
MR Jey - avatar
6 ответов
+ 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)?
23rd Oct 2019, 10:53 PM
HonFu
HonFu - avatar
+ 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.
23rd Oct 2019, 11:21 PM
HonFu
HonFu - avatar
+ 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
24th Oct 2019, 3:23 AM
Bilbo Baggins
Bilbo Baggins - avatar
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. 😅
24th Oct 2019, 7:43 AM
HonFu
HonFu - avatar