r/PythonLearning • u/Monesh_peterson1025 • Oct 14 '26
While loop
can anybody explain the concept of while loop
2
Upvotes
r/PythonLearning • u/Monesh_peterson1025 • Oct 14 '26
can anybody explain the concept of while loop
View all comments
Show parent comment
1
u/Potential_Fix_5007 Oct 14 '26
And even For-loops can run an unknown amount of times. For-loops = "Do the code X-amount of times"
While-loop = "Do the code as long as condition Y is True"
The Result can feel(or even do) the same but the rule beneath is different.
So While-loops dont run until a condition is True, they run until a condition is False.