Which of the following is a loop statement in Python?
Correct answer
B. for
9 views
B. for
9 views
for is a loop that repeats a block of code a set number of times, and while repeats it as long as a condition stays true. if is a selection statement that runs code only once when a condition holds, and print simply displays output. Loops are what save a programmer from writing the same line again and again.
Asked in: Matric,FBISE
Not sure why the answer is B? Ask here and get an explanation.