Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
The First while Loop | The while Loop
Python Loops Tutorial
course content

Contenido del Curso

Python Loops Tutorial

Python Loops Tutorial

1. The for Loop
2. The while Loop
3. Nested Loops

bookThe First while Loop

Let's proceed!

The while loop!

The while statement verifies a condition. The condition should yield a Boolean value, which can be either True or False.

If the condition evaluates to True, the while statement executes the statements contained within its block.

The while statement keeps reevaluating the condition with each iteration and continues to execute its block until the condition becomes False.

Take a look at the code below:

1234567
# Setting variable to change numbers i = 0 # Printing numbers from 0 to 9 while i < 10: print(i) i += 1
copy

How does the code work?

Tarea

Print numbers from 10 to 0.

  1. Initialize the while loop with the variable i.
  2. Continuously print the numbers while the loop is active.
  3. Decrease i by 1 with each iteration.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1
toggle bottom row

bookThe First while Loop

Let's proceed!

The while loop!

The while statement verifies a condition. The condition should yield a Boolean value, which can be either True or False.

If the condition evaluates to True, the while statement executes the statements contained within its block.

The while statement keeps reevaluating the condition with each iteration and continues to execute its block until the condition becomes False.

Take a look at the code below:

1234567
# Setting variable to change numbers i = 0 # Printing numbers from 0 to 9 while i < 10: print(i) i += 1
copy

How does the code work?

Tarea

Print numbers from 10 to 0.

  1. Initialize the while loop with the variable i.
  2. Continuously print the numbers while the loop is active.
  3. Decrease i by 1 with each iteration.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1
toggle bottom row

bookThe First while Loop

Let's proceed!

The while loop!

The while statement verifies a condition. The condition should yield a Boolean value, which can be either True or False.

If the condition evaluates to True, the while statement executes the statements contained within its block.

The while statement keeps reevaluating the condition with each iteration and continues to execute its block until the condition becomes False.

Take a look at the code below:

1234567
# Setting variable to change numbers i = 0 # Printing numbers from 0 to 9 while i < 10: print(i) i += 1
copy

How does the code work?

Tarea

Print numbers from 10 to 0.

  1. Initialize the while loop with the variable i.
  2. Continuously print the numbers while the loop is active.
  3. Decrease i by 1 with each iteration.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Let's proceed!

The while loop!

The while statement verifies a condition. The condition should yield a Boolean value, which can be either True or False.

If the condition evaluates to True, the while statement executes the statements contained within its block.

The while statement keeps reevaluating the condition with each iteration and continues to execute its block until the condition becomes False.

Take a look at the code below:

1234567
# Setting variable to change numbers i = 0 # Printing numbers from 0 to 9 while i < 10: print(i) i += 1
copy

How does the code work?

Tarea

Print numbers from 10 to 0.

  1. Initialize the while loop with the variable i.
  2. Continuously print the numbers while the loop is active.
  3. Decrease i by 1 with each iteration.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 1
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt