Ad
Code
Diff
  • def FindOnly(list):
        comparable_list = [(str(x), i) for i, x in enumerate(list)]
        comparable_list.sort()
        for i in range(-1, len(list)-1):
            if comparable_list[i][0] != comparable_list[i-1][0] and comparable_list[i][0] != comparable_list[i+1][0]:
                return list[comparable_list[i][1]]
    • def FindOnly(list):
    • try:
    • return [i for i in list if list.count(i)==1][0]
    • except:
    • return "Error"
    • comparable_list = [(str(x), i) for i, x in enumerate(list)]
    • comparable_list.sort()
    • for i in range(-1, len(list)-1):
    • if comparable_list[i][0] != comparable_list[i-1][0] and comparable_list[i][0] != comparable_list[i+1][0]:
    • return list[comparable_list[i][1]]