Python Introducing Lists Using Lists Iteration

Albert Vathapally
Albert Vathapally
575 Points

What does it mean to iderate? Im having trouble understanding

This was gone over in the beginning of the video im having trouble understanding

2 Answers

Steven Parker
Steven Parker
201,343 Points

"Iterate" is a just a fancy word for "repeat". It's commonly used to describe the action of a loop in code, where one or more steps are done over and over several times.

It's also used in reference to whatever controls how many times the loop will repeat (often a list of items, the loop repeats once for each of them).

Daniel Turato
PRO
Daniel Turato
Java Web Development Techdegree Graduate 30,116 Points

Iteration in python is where you want to run a piece of code until a certain condition is completed. There are two ways of doing this in python, for & while loops. So here's a few examples of loops:

This code below will loop each time until x is greater than 5.

x = 0

while (x < 5):
   print(x)
    x = x + 1

This code below does exactly the same as above but in a for loop

for x in range(6):
    print(x)

If you have questions you can ask me below or you can look at the documentation here - https://python101.pythonlibrary.org/chapter5_loops.html