Python Programming - Loops - Discussion
Discussion Forum : Loops - General Questions (Q.No. 25)
25.
Which loop in Python is primarily used for iterating over a sequence of numbers with a specified step size?
Answer: Option
Explanation:
The
for
loop in Python is commonly used for iterating over a sequence of numbers with a specified step size.
for i in range(0, 10, 2): # start at 0, stop before 10, step size of 2
print(i)
In this example, the for
loop iterates over the sequence of numbers from 0 to 8 (10 is not included) with a step size of 2, and prints each number to the console.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers