I found this code from one member and I can not understand why it does not work. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

I found this code from one member and I can not understand why it does not work.

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

11th Nov 2017, 1:34 AM
Porf
Porf - avatar
3 Respostas
+ 5
The code works fine, but the else block will never be reached, since the while loop will loop will loop until the user input 0 or 1 (or if incorrect type of input will error).
11th Nov 2017, 1:39 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
That is, if I want to get 1 or 0 from the user, I can not organize the loop like this? Or is the problem in the interpreter here?
11th Nov 2017, 1:43 AM
Porf
Porf - avatar
+ 1
Thanks to both of you. I understand the potential infinity of the loop, the problem was I did not understand if the code would cause an error in all shell's(what if it is usual python behavior). Now it's clear that the problem is in the local interpreter, and if I run it in IDLE, for example, it will work as it should, right?
11th Nov 2017, 2:11 AM
Porf
Porf - avatar