Contenido del Curso
Introduction to Python
3. Conditional Statements
Introduction to Python
Nested Loops
Just as you can nest lists within lists or tuples within tuples, you can also loop through elements that are already being looped over. For example, you can loop through a list that contains other lists.
Note
In this code,
j
represents each element within the nested lists inside thecountries
list. As the nested loop iterates,j
takes on the values of each element in the inner lists, which are then printed.
¿Todo estuvo claro?
Contenido del Curso
Introduction to Python
3. Conditional Statements
Introduction to Python
Nested Loops
Just as you can nest lists within lists or tuples within tuples, you can also loop through elements that are already being looped over. For example, you can loop through a list that contains other lists.
Note
In this code,
j
represents each element within the nested lists inside thecountries
list. As the nested loop iterates,j
takes on the values of each element in the inner lists, which are then printed.
¿Todo estuvo claro?