You can download this code by clicking the button below.
This code is now available for download.
This function is used to find the index of the substring `sub` in the string `s` and returns the position index. If the substring does not exist, it returns -1.
Technology Stack : String (str), find
Code Type : String lookup function
Code Difficulty :
def string_find_index(s, sub):
index = s.find(sub)
return index