Non-unique Elements 書き直し
def checkio(data): #Your code here #It's main function. Don't remove this function #It's used for auto-testing and must return a result for check. result = [] for x in data: if data.count(x) > 1: result.append(x) #replace this for solution return result
def checkio(data): #Your code here #It's main function. Don't remove this function #It's used for auto-testing and must return a result for check. return list(filter(lambda x: data.count(x) > 1,data))
二重ループが汚いので、書きなおした。
つまづいたところは、filterメソッドで帰ってくるのは、filterオブジェクトなのでちゃんとリストに変換してから返さなくちゃならないってこと。