Finding index of substring
How can I find the index of a substring(for both single and multiple occurence) in python without using any in-built function?
Incase you want a string x = "hello world hello I am namit jain hello everyone" y = "hello" for i in range(len(x) - len(y)): if x[i] == y and x[i + 1] == y and x[i + 2] == y and x[i + 3] == y and x[i + 4] == y: print(x.index(x[i]) But you can simply use the re module
BADAL BAHINIPATI No problem bhaiya👍👍👍
x = input() y = input("Enter the desired character") for i in x: if i == y: print(x.index(i))
Can suggest from where can I learn thoroughly about working with strings in python?
Ok bro thank you
SoloLearn will provide all the syntax to work with strings... Now according to me you can solve the code coach problems and if you want more then buy the pro, in order to get some practice and learn their application