Hackbright Code Challenges

Has Unique Characters

Has Unique Characters

Whiteboard

Easier

Concepts

Sets, Conditions

Download

has-unique-chars.zip

Solution

Has Unique Characters: Solution


Given a word, return True if that word contains only unique characters. Return False otherwise.

>>> has_unique_chars("Monday")
True

>>> has_unique_chars("Moonday")
False

>>> has_unique_chars("")
True

Uppercase and lowercase letters should be considered separately:

>>> has_unique_chars("Bob")
True

We’ve included hasuniquechars.py, which contains the stub of a has_unique_chars function:

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

Implement this function.