AI engineering glossary · Python core
What is for loop?
for loop: A loop that runs its block once for each item of an iterable such as a list, string, dictionary or range, assigning the current item to a loop variable. It is used when the number of repetitions follows from the data.
for loop: an example
for city in ['Delhi', 'Chennai']: print(city) prints each name on its own line.
Related terms
More Python core terms
Where you learn it
for loop is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.