While loop with input dont work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

While loop with input dont work

Why we can't use input in while loop in this Python editor ? https://sololearn.com/compiler-playground/cNWJGrt4NYMC/?ref=app

25th Apr 2024, 6:51 PM
Corentin Dos Santos
Corentin Dos Santos - avatar
4 Answers
+ 2
Corentin Dos Santos you have to put all the input() in at the beginning... Sololearn does use an interactive environment...
25th Apr 2024, 6:59 PM
BroFar
BroFar - avatar
+ 5
Corentin Dos Santos , the code is working properly (well done!), except the fact that sololearn is not working interactively. just a hint how we make the code a bit more efficient: since we only use the randint() method in the program, we do not need to import the complete random module by using from random import * we can use: from random import randint # only the randint() function is imported. this is saving some memory and execution time.
25th Apr 2024, 8:44 PM
Lothar
Lothar - avatar
+ 2
Thanks you, so i can't use Sololearn for this application
25th Apr 2024, 7:10 PM
Corentin Dos Santos
Corentin Dos Santos - avatar
+ 1
Ok thanks you for the tip !
26th Apr 2024, 5:02 AM
Corentin Dos Santos
Corentin Dos Santos - avatar