Iteration 1
Iteration 1
for x in __1_: __10_ (You can put your own values, starting point and end.)
(Do something)
for (int x=0; x=even numbers; x++)// general for high level language
Examples
for can also let you do something a certain number of times; you don’t even need to apply the
value of n.
Try this:
for n in 1:10
Iterators
What if we want to traverse a collection of objects?
A common scheme for stepping through all elements in any collection or container, is called
an iterator
2. while loop: used when you want to iterate until a certain condition is met, or when you
know in advance how many loop
A while loop is used when you want to iterate until a certain condition is met, or when you
know in advance how many loops to run.