For loop
Using range() with For Loop
The range() function is commonly used with for loops to generate a sequence of
numbers. It can take one, two, or three arguments:
• range(stop): Generates numbers from 0 to stop-1.
• range(start, stop): Generates numbers from start to stop-1.
• range(start, stop, step): Generates numbers from start to stop-1, incrementing by
step.
for i in range(0, 10, 2):
print(i)
1
2
3
4
5
N=5
For I in range( N):
Print(“*”)
COLUMN ROWS
6
7
8
9