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

Contenuti del Corso

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

book
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.

Compito

Swipe to start coding

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

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 4
toggle bottom row

book
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.

Compito

Swipe to start coding

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

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 4
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt