human
Check if a string is substring of another | Returns true if s1 is substring of s2.
A loop to slide pat [ ] one by one.
For current index i , check for pattern match.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if a string is substring of another and the other steps required.
 def isSubstring ( s1 , s2 ) :
	M = len ( s1 )
	N = len ( s2 )
	for i in range ( N - M + 1 ) :
		for j in range ( M ) :
			if ( s2 [ i + j ] != s1 [ j ] ) :
				break
		if j + 1 == M :
			return i
	return - 1
if __name__ == " _ _ main _ _ " :
	s1 = " for "
	s2 = " geeksforgeeks "
	res = isSubstring ( s1 , s2 )
	if res == - 1 :
		print ( " Not ▁ present " )
	else :
		print ( " Present ▁ at ▁ index ▁ " + str ( res ) )