Python Programming - Conditional Statements - Discussion
Discussion Forum : Conditional Statements - General Questions (Q.No. 4)
4.
Which of the following is the correct syntax for an
if
statement with multiple conditions?Answer: Option
Explanation:
The correct syntax for an if
statement with multiple conditions is to use elif
(short for "else if") for subsequent conditions after the initial if
statement.
Option A is also a valid syntax for handling multiple conditions, but it doesn't ensure mutual exclusivity between the conditions. In this case, both code blocks would execute if both condition1 and condition2 are true.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers