Conteúdo do Curso
Learn Python from Scratch
Learn Python from Scratch
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.
# iterate over string s = "small string" for i in s: print(i)
Or over list
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
The same applies to tuples.
Tarefa
Given list people
. Using for
loop, extract every single item from it.
Obrigado pelo seu feedback!
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.
# iterate over string s = "small string" for i in s: print(i)
Or over list
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
The same applies to tuples.
Tarefa
Given list people
. Using for
loop, extract every single item from it.
Obrigado pelo seu feedback!
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.
# iterate over string s = "small string" for i in s: print(i)
Or over list
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
The same applies to tuples.
Tarefa
Given list people
. Using for
loop, extract every single item from it.
Obrigado pelo seu feedback!
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.
# iterate over string s = "small string" for i in s: print(i)
Or over list
# iterate over list l = [1, [2,3], 4, "wow"] for i in l: print(i)
The same applies to tuples.
Tarefa
Given list people
. Using for
loop, extract every single item from it.