Sets Keep Unique Values
Sets automatically remove duplicates.
colors = {"red", "blue", "red"}
print(len(colors))Here is what the example does:
colorscreates a set and stores it incolors.print(len(colors))runslen(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
gemsto{'ruby', 'emerald', 'ruby'}. - Print the result of
len(gems).
Your finished program should print exactly this output:
2Be very careful with capitalization, spaces, and line breaks. The output must match exactly.