from typing import List def hasNoDuplicates(L: List[int]) -> bool: """Returns True if the list has no duplicates, False otherwise.""" return len(set(L)) == len(L) def testHasNoDuplicates(): print("Testing hasNoDuplicates()...", end="") assert hasNoDuplicates([1, 2, 3, 2]) == False assert hasNoDuplicates([1, 2, 3, 4]) == True assert hasNoDuplicates([]) == True assert hasNoDuplicates([42]) == True assert hasNoDuplicates([42, 42]) == False # Verify that the function is nonmutating: L = [1, 2, 3, 2] hasNoDuplicates(L) assert L == [1, 2, 3, 2] print("Passed!") def main(): testHasNoDuplicates() main()