#A. Write a function called # lastIndexOf #The function # -takes a string and a character (one-character string) as parameters, and # -finds and prints the last index of occurrence of the character in # the string. The function print -1 if the character doesn't # exist in the string. def lastIndexOf(phrase,char): index=-1 for i in range(len(phrase)): if phrase[i]==char: index=i print index lastIndexOf("apple", "p") lastIndexOf("apple", "b") #B. Write a function # firstIndexOf # that takes a string and a character (one-character string) as parameters, # and finds and prints the first index of occurrence of the character # in the string. Print -1 if the character doesn't exist in the string. def firstIndexOf(phrase,char): index=-1 for i in range(len(phrase)): if phrase[i]==char and index==-1: index=i print index