A Loop Inside a Loop
Loops within loops.
Loops Are Awesome! 🔁
Hi superstar! 🌟 You already know a loop repeats things. Today we learn something SUPER cool: a loop inside another loop!
It's like a robot doing a little dance over and over, while a bigger robot makes it dance again and again! 🤖
for i in range(3):
print('Outer loop! 🤖')What Is Nesting? 🪺
When you put one loop inside another, we call it a nested loop. Just like a tiny bird's nest sitting inside a big tree! 🪺🌳
The inside loop finishes ALL its turns before the outside loop moves on.
for big in range(2):
for small in range(2):
print('hello!')All lessons in this course
- A Loop Inside a Loop
- Drawing a Grid
- Star Triangles
- Multiplication Table