Iteration
overview
Summary
Iteration repeats actions over sequences or conditions. Use for to traverse iterables and while for condition-driven loops. Initialize and update loop variables correctly to avoid off-by-one errors and infinite loops. Prefer iterating items directly rather than by index, or use enumerate for index-value pairs. range(start, stop, step) excludes stop. Use break to exit, continue to skip, and else on loops for no-break completion. Keep nested loops minimal and watch complexity. Test boundary cases and small inputs.