+ 1

Python code doesn't work here

I added a "guess the number" Python code to my profile. The same code works in my idle on PC, but it doesn't work in the playground of the app. I don't understand why it doesn't work here. https://code.sololearn.com/cXQUI8R30d57/?ref=app

14th Oct 2018, 12:51 PM
CodeSlayer
CodeSlayer - avatar
2 odpowiedzi
+ 3
The problem is with the line "guess = int(input("Guess the number: "))" in the loop. It is perhaps because of the playground console on SL. It executes the program as whole, so it doesnt give you chance for multiple inputs, only one :/ And if you leave that one line mentioned earlier, it just adds up to "try" if you dont guess the number and you lose the game.. So you got one chance only :D Btw nice code :)
14th Oct 2018, 12:59 PM
Proff
Proff - avatar
+ 1
Thank you so much Proff! 😊
14th Oct 2018, 1:02 PM
CodeSlayer
CodeSlayer - avatar