Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions easy/substring.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ def substring(str1, str2):
return True
return False


# with single loop

def str_search(str1, str2):
for i in range(len(str2) - len(str1) + 1):
if str1 == str2[i:i+len(str1)]:
return True
else:
return False