Loops in Python


Understand how to use loops to repeat code, a fundamental concept for automating repetitive tasks.

Source Code

# For loop
for i in range(5):
    print(i)

# While loop
x = 0
while x < 5:
    print(x)
    x += 1
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments