{} creates an empty dictionary. You must use set(). — {} creates an empty dictionary. You must use set().
Sets keep their items in the order you inserted them.
Reveal answer
Sets are completely unordered collections. — Sets are completely unordered collections.
You can access the first item in a set using my_set[0].
Reveal answer
Sets are not sequences; they do not support indexing. — Sets are not sequences; they do not support indexing.
Sets can contain lists or dictionaries.
Reveal answer
Set elements must be hashable, meaning they cannot be mutable objects like lists or dictionaries. — Set elements must be hashable, meaning they cannot be mutable objects like lists or dictionaries.
Challenges
Challenge 1 +15 XP
Write a function 'unique_names' that takes a list of names and returns a new list with all duplicates removed, sorted alphabetically.
python
Test 1 — expects "['Alice', 'Bob', 'Charlie'] \n"
Need a hint? (−25% XP)
Convert the list to a set to remove duplicates, then back to a list, and finally use sorted().