About Lesson
- Loops: Master
for
andwhile
loops for iteration.
Loops allow us to repeat a block of code multiple times. Two common types are:
-
for
Loop:for i in range(5):
print(f”Count: {i}”)//This loop will print numbers from 0 to 4.
while
Loop:
num = 1
while num <= 10:
print(num)
num += 1
// This loop will print numbers from 1 to 10.
Join the conversation