Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ This is a function called find_my_letter to search for the index of
- the first occurence of a character in a string """
- # This function accepts two arguments
- def find_my_letter(string, char):
- # using the find method to search for the index of a character in the string
- find_letter = string.find(char)
- # Returning the index of the character
- return find_letter
- # Function Invokation
- print(find_my_letter("dangerous", "a"))
- print(find_my_letter("bazooka", "z"))
- print(find_my_letter("lollipop", "z"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement