Question: 17. Two string methods find where a character is in a string: find and index. (a) Both work the same if a character is

17. Two string methods find where a character is in a string: 

17. Two string methods find where a character is in a string: find and index. (a) Both work the same if a character is found, but behave differently if the character is not found. Describe the difference in how they behave when the character is not found. (b) The find and index methods are not limited to finding single characters. They can search for substrings. Given s= "Topkapi", what does s. find ("kap") print? Describe the rule for what find prints.

Step by Step Solution

3.42 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a The find method returns the lowest index in the string where the ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!