I want to know why this code line goes into a loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to know why this code line goes into a loop?

https://code.sololearn.com/cjQNPivtW0zm? ref=app This was a question I came across. Indeed, I was expecting it to end up with an error.

31st Oct 2019, 12:27 PM
Baran Aldemir
Baran Aldemir - avatar
3 Answers
+ 1
What's your question ? It doesn't run into a loop, and you already know it should output an error, so what is it you want exactly ?
31st Oct 2019, 12:49 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
First of all there is error in your code Make line 2 - while num in range(6): It goes into a loop because 5 is within the range of 6 and while loop is true forever.
31st Oct 2019, 1:02 PM
Avinesh
Avinesh - avatar
0
Sorry guys I forgot to write "num" . And thank you Avinesh P for your answer. I got it.
31st Oct 2019, 1:51 PM
Baran Aldemir
Baran Aldemir - avatar