Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Patrón de Bucle Anidado Primero | Nested Loops
course content

Contenido del Curso

Python Loops Tutorial

Patrón de Bucle Anidado PrimeroPatrón de Bucle Anidado Primero

A nested loop is a loop located within the body of an outer loop. Either the inner or outer loop can take on various forms, including a while loop or a for loop. For instance, the outer for loop can encompass a while loop, and conversely.

Initially, let's attempt to create a basic image using a nested loop.

Employ end = ' ' within the print function to display elements in a row.

Examine the code below:

How does the code work?

Tarea

You should reverse the triangle shown in the example.

  1. Configure the range() function for the outer for loop with step = -1.
  2. Configure the range() function for the inner for loop.
  3. Print '*' within the nested loop.

¿Todo estuvo claro?

Sección 3. Capítulo 1
toggle bottom row
course content

Contenido del Curso

Python Loops Tutorial

Patrón de Bucle Anidado PrimeroPatrón de Bucle Anidado Primero

A nested loop is a loop located within the body of an outer loop. Either the inner or outer loop can take on various forms, including a while loop or a for loop. For instance, the outer for loop can encompass a while loop, and conversely.

Initially, let's attempt to create a basic image using a nested loop.

Employ end = ' ' within the print function to display elements in a row.

Examine the code below:

How does the code work?

Tarea

You should reverse the triangle shown in the example.

  1. Configure the range() function for the outer for loop with step = -1.
  2. Configure the range() function for the inner for loop.
  3. Print '*' within the nested loop.

¿Todo estuvo claro?

Sección 3. Capítulo 1
toggle bottom row
some-alt