102k views
5 votes
Which statement correctly creates a set named colors that contains the 7 colors in a rainbow?

a. colors = ["red", "orange", "yellow" "green", "blue", "indigo", "violet"]
b. colors = {red, orange, yellow, green, blue, indigo, violet}
c. colors = [red, orange, yellow, green, blue, indigo, violet]
d. colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

User Jamily
by
5.2k points

1 Answer

4 votes

Answer: d. colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

Step-by-step explanation:

We use "{}" to write a set in it.

Also, the names of the colors are strings so we use inverted commas ("") to express them.

So, the set named colors that contains the 7 colors in a rainbow will be:

colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

Hence, the correct option is d.

User Agung Setiawan
by
4.9k points