Certified Entry-Level Python Programmer (PCEP-30-02) — Question 72
Assuming that the following assignment has been successfully executed:
the_list = [“1”, 1, 1.]
Which of the following expressions evaluate to True? (Choose two.)
Answer options
- A. 1.1 in the_list[1:3]
- B. the_list.index(“1”) in the_list
- C. len(the_list[0:2]) < 3
- D. the_list.index(‘1’) == 0
Correct answer: C, D
Explanation
Option C is correct because slicing the list results in two elements, making the length less than three. Option D is also correct as the index of '1' in the list is indeed 0. Options A and B are incorrect because 1.1 is not in the specified slice and the index of '1' is not an element of the list.