L1/10

Sets Keep Unique Values

Sets automatically remove duplicates.

python
colors = {"red", "blue", "red"}
print(len(colors))

Here is what the example does:

  • colors creates a set and stores it in colors.
  • print(len(colors)) runs len(colors) and displays the returned value.

The assignment changes the specific values, but the basic pattern is the same.

Assignment

Complete the starter code so the program does the following:

  • Set gems to {'ruby', 'emerald', 'ruby'}.
  • Print the result of len(gems).

Your finished program should print exactly this output:

text
2

Be very careful with capitalization, spaces, and line breaks. The output must match exactly.