?
Which of the following is NOT a valid loop in Python?
Answer & Solution
Correct Answer:
Option
B
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.
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.
Join the Discussion
Login to post a comment or share your explanation.
Login