Ad
Code
Diff
  • from re import search
    def common_substring(string, sub_str):
        if search(sub_str, string):
            return True
        return False    
    • from re import search
    • def common_substring(string, sub_str):
    • is_in = False
    • j = len(sub_str)
    • for i in range(0, len(string) - j + 1):
    • if string[i: i + j] == sub_str:
    • is_in = True
    • return is_in
    • if search(sub_str, string):
    • return True
    • return False