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

Conteúdo do Curso

Python Loops Tutorial

Python Loops Tutorial

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

The first for Loop

In computer programming, a loop is a series of instructions that continuously repeats until a specific condition is met.

We'll begin our exploration of Python loops with a for loop.

The for loop enables us to iterate through each item in a sequence and perform the same set of operations for each item. By using for loops in Python, we can efficiently automate and repeat tasks.

Now, let's delve into how the for loop program functions.

Imagine we have the string 'Enjoy the silence', and our goal is to print this string in a column.

Take a look at the code below:

12345
text = 'Enjoy the silence' # Printing every letter in the text for i in text: print(i)
copy

How does the code work?

It's time to write our first loop!

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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

The first for Loop

In computer programming, a loop is a series of instructions that continuously repeats until a specific condition is met.

We'll begin our exploration of Python loops with a for loop.

The for loop enables us to iterate through each item in a sequence and perform the same set of operations for each item. By using for loops in Python, we can efficiently automate and repeat tasks.

Now, let's delve into how the for loop program functions.

Imagine we have the string 'Enjoy the silence', and our goal is to print this string in a column.

Take a look at the code below:

12345
text = 'Enjoy the silence' # Printing every letter in the text for i in text: print(i)
copy

How does the code work?

It's time to write our first loop!

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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

The first for Loop

In computer programming, a loop is a series of instructions that continuously repeats until a specific condition is met.

We'll begin our exploration of Python loops with a for loop.

The for loop enables us to iterate through each item in a sequence and perform the same set of operations for each item. By using for loops in Python, we can efficiently automate and repeat tasks.

Now, let's delve into how the for loop program functions.

Imagine we have the string 'Enjoy the silence', and our goal is to print this string in a column.

Take a look at the code below:

12345
text = 'Enjoy the silence' # Printing every letter in the text for i in text: print(i)
copy

How does the code work?

It's time to write our first loop!

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

In computer programming, a loop is a series of instructions that continuously repeats until a specific condition is met.

We'll begin our exploration of Python loops with a for loop.

The for loop enables us to iterate through each item in a sequence and perform the same set of operations for each item. By using for loops in Python, we can efficiently automate and repeat tasks.

Now, let's delve into how the for loop program functions.

Imagine we have the string 'Enjoy the silence', and our goal is to print this string in a column.

Take a look at the code below:

12345
text = 'Enjoy the silence' # Printing every letter in the text for i in text: print(i)
copy

How does the code work?

It's time to write our first loop!

Tarefa

  1. Create the for loop to operate on the text, employing i as an element of the text.
  2. Within the for loop, duplicate each element of the text.
  3. Inside the for loop, append an exclamation mark ('!') after each element.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 1
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt