Question Detail

COS 102 If staments Objective Question

Question

Which Python structure is best suited for implementing 'multiple choices' or a sequence of conditions that are checked one by one?
Options
A A series of independent <code>if</code> statements
B An <code>if-else</code> statement
C An <code>if-elif-else</code> statement
Correct Answer
D A <code>while</code> loop
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 9, 'The 'Elif' (Multiple Choices)', clearly states that 'When you have more than two options, use elif (short for 'else if').' and that 'Python checks these one by one until it finds a True one!'.

Hint

This structure provides a way to handle more than just two possible outcomes.

Question Info