For Loop
For Loop
INTERVIEW QUESTIONS
3. What is range?
Ans:
In Python, range is a built-in function that generates an iterable sequence of
numbers, allowing you to loop over a specified range of values.
Syntax:
range(start, stop, step)
Parameters:
1. start: The initial value (inclusive).
2. stop: The final value (exclusive).
3. step: The increment between values (default is 1).
for i in range(5):
print(i) # 0, 1, 2, 3, 4