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

Added 5 Feb 2024

What is the purpose of the 'if' statement in Python?

  1. To create a loop
  2. To define a function
  3. To handle conditions and make decisions Correct answer
  4. To import external libraries

Correct answer

C. To handle conditions and make decisions

16 views

MCQSEXAM

Explanation

The 'if' statement is used to introduce conditional logic in Python. It allows the program to make decisions based on whether a given condition is true or false.

Reference

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

Doubts & discussion

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