0
How is the condition in the part "while True" is met? It doesn't make any sense to me at all, can someone please explain it to me? I'm in the process of learning python, and I want to understand how every single aspect of its programming syntax works.
For example: x = o while True: print(x) x = x + 1 if x <= 5: break
2 Réponses
+ 2
sometimes you have no idea that exactly when your algorithm in the loop should be stop, you can use an infinite loop (while true) and at least declare a condition in loop's body too break it
+ 1
You basically tell the loop that it will always be true, imagine making a variabe y and assign True to it, then use while y do something, and since y wont change, its always gonna be True. Except here you right away just tell python it's always True.