Exam PCAP All QuestionsBrowse all questions from this exam
Question 138

Which of the following invocations are valid? (Choose two.)

    Correct Answer: B, C

    The question asks which of the following invocations are valid. Option B is valid because the find() method is a built-in string method in Python that searches for a specified substring within the string. Option C is also valid because the rindex() method is another built-in string method that returns the highest index of a specified substring within the string. Options A and D are invalid: Option A attempts to use a sort function incorrectly on a string, and Option D incorrectly tries to use the sorted() method on a string, which should be used on iterables like lists, but not strings.

Discussion
macxszOptions: BC

The only correct statements: B. "python".find("") C. "python".rindex("th")

andr3Options: AB

can admin edit the Q with correct signs ? A. sort(ג€pythonג€) B. ג€pythonג€.find(ג€ג€) C. ג€pythonג€.rindex(ג€thג€) D. 'python'.sorted()