Certified Associate in Python Programming (PCAP) — Question 44
Which of the following expressions evaluate to True? (Choose two.)
Answer options
- A. str(1-1) in '123456789'[:2]
- B. 'dcb' not in 'abcde'[::-1]
- C. 'phd' in 'aplpha'
- D. 'True' not in 'False'
Correct answer: A, D
Explanation
Option A evaluates to True because '0' (the result of str(1-1)) is present in '12'. Option D also evaluates to True since the string 'True' does not exist within 'False'. Options B and C are incorrect as they evaluate to False; 'dcb' is not absent from the reversed string and 'phd' is not found within 'aplpha'.