Mastery 16 - Which Repetition?
When do I need to use a while loop, a for loop or recursion?The application of each one depends on what you want to do and how these loops work:
- While: it will perform a specific activity or series of steps until a certain condition that it’s true turns to false. Useful when you need to repeat a series of state until a statement is fulfilled.
- For: it executes a set of steps once for each value or item in a list, tuple, set, etc.. Useful when you need to apply a series of steps on each value of a variable.
- Recursion: calls a function inside a function. This process requires a previous answer from this same process or another one.













