Graphical Explanation of "for Loop-range Function" in Python

by matt392 in Circuits > Software

3 Views, 0 Favorites, 0 Comments

Graphical Explanation of "for Loop-range Function" in Python

for-range-graphic.png

Graphical Explanation of "for loop-range function" in Python.

Graphical Explanation of "for Loop-range Function" in Python.

for-range-graphic.png

Example:

for number in range(1, 101, 1)

Using “for” loop:

- Each number from list

- placed in variable “number”

- during every pass of the “for” loop

Using the “range” function:

- Create a list starting at “1”

- then increment the list by “1” for each subsequent number in list

- until you hit “100”