list에 유니크한 값만 있는지 비교
유니크한 값이면 true
중복값이 있으면 false를 반환
def all_unique(lst):
# set 함수를 이용해 중복값을 제거한후 length를 비교
return len(lst) == len(set(lst))
if __name__ == '__main__':
x = [1, 2, 3, 4, 5, 6]
y = [1, 2, 2, 3, 4, 5]
print(all_unique(x))
print(all_unique(y))
>>> python all_unique.py
True
False