Python TutorialLesson 21Free preview
Python For Loops
This lesson is part of Python · All levels
Summary
For loops are used to repeat each element in a collection such as a list, string, or range. Inside his body we can either completely break out or go through the rest of the iterations running on the continuum. Iteration can also be performed with a sequence number using a practical enumerate() function.
Key points
- For repeating an item on an item that can be repeated (iterable).
- Break stops the repetition while continue on to the next iteration.
- For can be through list, string, dictionary, or range.
- Enumerate() gives the order number and value of each iteration.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.