Two string methods find where a character is in a string


Question: 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 they 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.

Solution Preview :

Prepared by a verified Expert
Finance Basics: Two string methods find where a character is in a string
Reference No:- TGS02476742

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)