반응형

취미생활 25

[checkIO]Home 01.All the Same

In this mission you should check if all elements in the given list are equal. Input: List. Output: Bool. ​ Example: all_the_same([1, 1, 1]) == True all_the_same([1, 2, 1]) == False all_the_same(['a', 'a', 'a']) == True all_the_same([]) == True ​ * 리스트가 모두 같은지 확인해야한다. * 리스트가 빌 경우에도 True를 리턴한다. - 풀이 def all_the_same(elements: List[Any]) -> bool: return len(set(elements))

반응형