PCEP-30-02 · Question #345
Assuming that the following assignment has been successfully executed: the_list = ['list', False, 3e8] Which of the following expressions evaluate to True? (Choose two.)
The correct answer is B. the_list[1] in the list. Option B evaluates to True because the_list[1] is False, and since False is literally stored in the list, False in the_list returns True. Note the question says choose two - D is also correct: the_list.index(False) scans left to right using ==; 'list' == False is False, so it…
Question
the_list = ['list', False, 3e8]
Which of the following expressions evaluate to True? (Choose two.)Options
- Aint(the_list[2]) == len(the_list)
- Bthe_list[1] in the list
- C300 in the_list and the_list[1]
- Dthe_list.index(False) == 1
How the community answered
(21 responses)- A10% (2)
- B81% (17)
- C5% (1)
- D5% (1)
Explanation
Option B evaluates to True because the_list[1] is False, and since False is literally stored in the list, False in the_list returns True. Note the question says choose two - D is also correct: the_list.index(False) scans left to right using ==; 'list' == False is False, so it skips index 0, then finds False == False at index 1 and returns 1, making 1 == 1 → True.
A is wrong because int(the_list[2]) = int(3e8) = 300,000,000, which is not equal to len(the_list) = 3.
C is wrong because 3e8 is 300,000,000 - not 300 - so 300 in the_list is False; the and short-circuits and the entire expression is False regardless of the_list[1].
Memory tip: 3e8 means 3 × 10⁸ = 300,000,000 - the e is scientific notation, not shorthand for a small number. Whenever you see eN in a float, mentally multiply by 10^N before checking membership or equality.
Community Discussion
No community discussion yet for this question.