Vidyalelo
Python · Q16

Python Introduction and basic

Programming · Python · question 16

Q16

Which of the following is NOT a valid loop in Python?

A.
while loop
B.
until loop
Answer
C.
for loop
D.
do-while loop

Answer: Option B

Solution

Answer: Option B
Solution:
In Python, until loop is not a valid loop construct.
Python does not have an "until" loop construct like some other programming languages such as Ruby or Perl. Instead, Python provides the while loop for executing a block of code repeatedly as long as a condition is true, and the for loop for iterating over a sequence of elements. Additionally, Python does not have a built-in "do-while" loop construct like some other languages, but similar behavior can be achieved using the while loop in combination with a pre-test.