Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

maybe you had a typo? or they have corrected this in the meantime? I just tried this problem and it was error free.

def unique(values): """Finds all unique elements of a list.

        >>> unique([])
        []
        >>> unique([1, 2, 1])
        [1, 2]
        >>> unique([1, 2, 1, 3, 4, 2])
        [1, 2, 3, 4]
    """
    # your code here
    return list(set(values))

it also works without the coercion to list. return set(values) is fine.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: