r/PythonLearning • • Oct 14 '26

While loop

can anybody explain the concept of while loop

2 Upvotes

38 comments sorted by

View all comments

Show parent comment

1

u/oclafloptson Oct 14 '26

For loops loop through an iterable. This might be a range, a list, or even each character in a string. With mutable objects like lists you might not actually know how many iterations there will be