In this introductory tutorial, you’ll learn all about how to perform definite iteration with Python for loops. You’ll see how other programming languages implement definite iteration, learn about iterables and iterators, and tie it all together to learn about Python’s for loop.

This tutorial will show you how to perform definite iteration with a Python for loop.

In the previous tutorial in this introductory series, you learned the following:

  • Repetitive execution of the same block of code over and over is referred to as iteration.
  • There are two types of iteration:
  • Definite iteration, in which the number of repetitions is specified explicitly in advance
  • Indefinite iteration, in which the code block executes until some condition is met
  • In Python, indefinite iteration is performed with a while loop.

Here’s what you’ll cover in this tutorial:

  • You’ll start with a comparison of some different paradigms used by programming languages to implement definite iteration.
  • Then you will learn about iterables and iterators, two concepts that form the basis of definite iteration in Python.
  • Finally, you’ll tie it all together and learn about Python’s for loops.

#python

Python "for" Loops (Definite Iteration)
13.20 GEEK