Looping
Understand for and while loops to automate repetitive tasks in your programs.
1
Introduction to Loops
Loops allow you to repeat a block of code multiple times, making your programs more efficient and concise.
In this lesson, you’ll learn about different types of loops in Python: for, while, and nested loops.

2
What is a Loop?
A loop is used to execute a block of code repeatedly until a certain condition is met. For example:
This prints the numbers 0 to 4.
# Example of a loop
for i in range(5):
print(i)