There are 3 types of repetition:
-For loop
-While loop
-Recursion

The FOR loop is used when you know the number of repetitions. It can be used with ranges, list tuples or dictionaries(iterable objects).  It takes a value inside the object, work with it, and then do the same thing with the next value until the iterable object is finished.

The WHILE loop is used when you dont how the number of repetitons. It works with a condition and it will repeat until the condition is false.

Recursion is when you call a function inside the same function. It can be used in special cases where you need to take a value from the function itself, this job can be done with FOR or WHILE loops but it´s shorter to write a recursion.

CC BY 4.0 Mastery 22 – Types of repetition by Jose Carlos Peñuelas Armenta is licensed under a Creative Commons Attribution 4.0 International License.