The conversation between human and AI assistant.
How do I determine if a string has all unique characters?
That also looks simple, but how does it work?
This function creates an empty dictionary called `char_counts`. It then iterates through each character in the string. If a character is already a key in the `char_counts` dictionary, that means it's not unique and the function returns `False`. Otherwise, it adds the character to the dictionary with a value of `1`. If the function makes it through the entire loop, that means all characters in the string are unique and it returns `True`.