Certified Associate in Python Programming (PCAP-31-03) — Question 6
Which of the following invocations are valid? (Choose two.)
Answer options
- A. sort("python")
- B. "python".find("")
- C. "python".sort()
- D. sorted("python")
Correct answer: B, D
Explanation
The correct answers are B and D because the find method can be called on a string to locate a substring, and the sorted function can be used to return a sorted list from a string. Options A and C are incorrect since the sort method is not applicable to strings directly.