On Python, there are three different ways of make a repetitive task:

for statement:

for loops are the best option when you want to repeat an action for a fixed amount of elements.

while statement:

The best moment for use a while loop is when you want a program to run a certain condition is reached.

recursion with functions

This one is better when you want to simplify your code or when the loops gets hard to do complex tasks.

CC BY 4.0 #Mastery22 by jsphsalazar is licensed under a Creative Commons Attribution 4.0 International License.