Ad
Code
Diff
  • def common_substring(string, sub_str):
        return sub_str in string
    • def common_substring(string, sub_str):
    • return string.__contains__(sub_str)
    • return sub_str in string
Code
Diff
  • def FindOnly(list):
        try:
            return [i for i in list if list.count(i)==1][0]
        except:
            return "Error"
    • def FindOnly(list):
    • for i in range(len(list)):
    • if list[i] not in list[:i]:
    • if list[i] not in list[(i+1):]:
    • return list[i]
    • try:
    • return [i for i in list if list.count(i)==1][0]
    • except:
    • return "Error"