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

Conteúdo do Curso

Python Loops

Python Loops

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

bookSimple 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

Tarefa

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 1
toggle bottom row

bookSimple 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

Tarefa

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 1
toggle bottom row

bookSimple 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

Tarefa

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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

Tarefa

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 3. Capítulo 1
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt