1. Home
  2. Data Science
  3. Python
  4. What is the purpose of the 'elif' statement?

Added 5 Feb 2024

What is the purpose of the 'elif' statement?

  1. To terminate the program
  2. To handle multiple conditions after an 'if' statement Correct answer
  3. To define a function
  4. To repeat a block of code

Correct answer

B. To handle multiple conditions after an 'if' statement

19 views

MCQSEXAM

Explanation

The 'elif' statement is used in conjunction with 'if' to handle multiple conditions in a sequence. It allows for checking additional conditions if the preceding 'if' or 'elif' statements are false.

Reference

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

Doubts & discussion

Not sure why the answer is B? 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