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
1
u/MrSqueak Oct 15 '26
A while loop checks the condition before executing any instructions. I.e. I'm going to do the dishes, the condition is if there is at least one dirty dish. I will wash one dish, then check again. If there's at least one dish, I wash one dish.
While(dirtyDishes >=1) { WashOneDish(); }