1. Home
  2. Data Science
  3. Python
  4. Which of the following statements is used to execute a…

Added 10 Feb 2024

Which of the following statements is used to execute a block of code repeatedly in Python?

  1. if
  2. else
  3. for
  4. while Correct answer

Correct answer

D. while

17 views

MCQSEXAM

Explanation

The 'while' loop in Python is used to repeatedly execute a block of code as long as a specified condition evaluates to true. It is useful when the number of iterations is not known beforehand.

Reference

https://www.w3schools.com/python/default.asp

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs