Hackbright Code Challenges

Has Unique Characters: Solution

Has Unique Characters: Solution

Problem

Has Unique Characters

Whiteboard

Easier

Concepts

Sets, Conditions

Download

has-unique-chars-solution.zip


Sets are a great way to do this, since they remove duplicates automatically:

hasuniquechars.py
def has_unique_chars(word):
    """Does word contains unique set of characters?"""

    # START SOLUTION

    unique_word = set(word)

    return len(unique_word) == len(word)