In this code I can not do a while loop of 3 turns ... To put 2 entries, then another and then another, to know which of the two | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

In this code I can not do a while loop of 3 turns ... To put 2 entries, then another and then another, to know which of the two

https://code.sololearn.com/c1CNArRh22Hr/?ref=app

9th Feb 2018, 8:21 AM
Raúl Almagro
Raúl Almagro - avatar
3 Answers
+ 8
For starters, you've created an endless loop because you used =+ instead of +=. If you delete everything after the first 4 lines and run the code both ways you will see the difference. To get your code back, press the 3 dots in the corner and select 'reset code'. [The easier way to debug code is to 'comment out' (put """ before and after the block of code or put # in front of each line) the rest of the code, but because of the way the code playground works, if the commented code contains the word 'input', you are prompted for an input even if the code is commented out, which can be confusing.] The second issue is you need to put all the actions you want to repeat *inside* the while loop, otherwise the loop just prints and increments your counter. Because the code playground requires all your data to be input before it runs the code, you have to type each input on a separate line before hitting 'submit'. In general, it's best to avoid writing code requiring several inputs in the SoloLearn Code Playground. Better to use a mobile IDE like QPython3 or Pydroid, or, e.g., IDLE or VS Code on your PC.
9th Feb 2018, 10:01 AM
David Ashton
David Ashton - avatar
+ 7
PS I see this is really a duplicate of your previous question. Please just ask your questions once. You will get answers. 😉 https://www.sololearn.com/Discuss/1063318/?ref=app
9th Feb 2018, 10:07 AM
David Ashton
David Ashton - avatar
+ 4
Thank you David, it has been very helpful
9th Feb 2018, 10:26 AM
Raúl Almagro
Raúl Almagro - avatar