Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Simple For Loops | For Loops
Python Loops
course content

Contenido del Curso

Python Loops

Python Loops

1. While Loops: Get Started
2. While Loops: Essentials
3. For Loops
4. Nested Loops

Simple For Loops

Finally, more interesting Python loops! There is another type of loops with the following syntax:

12
for val in list: instructions
copy

val receives the current value from list on each iteration. This way, you don't need any stop condition in your loop and it never becomes infinite. Use for loop for any iterable object: list, tuple, string, etc.

By the way, it is much more appropriate to iterate string using for loop instead of while.

123
string = 'You are rockstar' for sym in string: print(sym * 13)
copy

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

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

Simple For Loops

Finally, more interesting Python loops! There is another type of loops with the following syntax:

12
for val in list: instructions
copy

val receives the current value from list on each iteration. This way, you don't need any stop condition in your loop and it never becomes infinite. Use for loop for any iterable object: list, tuple, string, etc.

By the way, it is much more appropriate to iterate string using for loop instead of while.

123
string = 'You are rockstar' for sym in string: print(sym * 13)
copy

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

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

Simple For Loops

Finally, more interesting Python loops! There is another type of loops with the following syntax:

12
for val in list: instructions
copy

val receives the current value from list on each iteration. This way, you don't need any stop condition in your loop and it never becomes infinite. Use for loop for any iterable object: list, tuple, string, etc.

By the way, it is much more appropriate to iterate string using for loop instead of while.

123
string = 'You are rockstar' for sym in string: print(sym * 13)
copy

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Finally, more interesting Python loops! There is another type of loops with the following syntax:

12
for val in list: instructions
copy

val receives the current value from list on each iteration. This way, you don't need any stop condition in your loop and it never becomes infinite. Use for loop for any iterable object: list, tuple, string, etc.

By the way, it is much more appropriate to iterate string using for loop instead of while.

123
string = 'You are rockstar' for sym in string: print(sym * 13)
copy

Tarea

Change the given word by skipping all spaces, like:

And I don't wanna miss a thing -> AndIdon'twannamissathing

Use for loop. Create new_word for that, modify it inside the loop and output it.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 3. Capítulo 1
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt