Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
for loop (2/5) | Loops
Learn Python from Scratch
course content

Course Content

Learn Python from Scratch

Learn Python from Scratch

1. The basics
2. Arithmetic operations
3. Common data types
4. Conditional statements
5. Other data types
6. Loops
7. Functions

for loop (2/5)

Remember data types we learned previously? for loop can easily iterate over some of them. For example, you can easily iterate over a string to get all symbols from it.

1234
# iterate over string s = "small string" for i in s: print(i)
copy

Or over list

1234
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
copy

The same applies to tuples.

Task

Given list people. Using for loop, extract every single item from it.

Task

Given list people. Using for loop, extract every single item from it.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 6. Chapter 4
toggle bottom row

for loop (2/5)

Remember data types we learned previously? for loop can easily iterate over some of them. For example, you can easily iterate over a string to get all symbols from it.

1234
# iterate over string s = "small string" for i in s: print(i)
copy

Or over list

1234
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
copy

The same applies to tuples.

Task

Given list people. Using for loop, extract every single item from it.

Task

Given list people. Using for loop, extract every single item from it.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 6. Chapter 4
toggle bottom row

for loop (2/5)

Remember data types we learned previously? for loop can easily iterate over some of them. For example, you can easily iterate over a string to get all symbols from it.

1234
# iterate over string s = "small string" for i in s: print(i)
copy

Or over list

1234
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
copy

The same applies to tuples.

Task

Given list people. Using for loop, extract every single item from it.

Task

Given list people. Using for loop, extract every single item from it.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Remember data types we learned previously? for loop can easily iterate over some of them. For example, you can easily iterate over a string to get all symbols from it.

1234
# iterate over string s = "small string" for i in s: print(i)
copy

Or over list

1234
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
copy

The same applies to tuples.

Task

Given list people. Using for loop, extract every single item from it.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 6. Chapter 4
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt