Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Built-in Functions Common to Most Data Structures
14. Question 2


Nicely done! How about Question 2?


Write a function named second_index(input_string, input_char) that returns the index of the second occurrence of input_char in input_string. If there is no such occurrence, return -1.

Stuck? Here's a hint!

First, you should find an index of first occurence, then slice the string:


and find the index of the first occurrence of the letter in the sliced string. Then return the right result.

If input_char occurs only once in the string or doesn't appear at all, return -1.