Question: 3 . 4 : Set basics 5 4 1 0 1 6 . 3 9 0 0 8 8 0 . 9 3 2 9

3.4: Set basics
541016.3900880.9329y7
Jump to level 1
Set colors_considered is initialized with four colors read from input. Assign num_colors with the number of elements in colors_considered. Then, clear colors_considered.
Click here for example
Ex. If the input is:
aqua
blue
maroon
red
then the output is:
Number of values considered: 4
[]
Note: Because sets are unordered, the set is printed using the sorted() function here for comparison.
colors_considered = set ()
new_color1= input()
new_color2= input()
new_color3= input ()
new_color4= input ()
colors_considered.add(new_color1)
colors_considered.add(new_color2)
colors_considered.add(new_color3)
colors_considered,add(new_color4)
I'" Your code goes here "'"
print (f'Number of values considered: {num_colors }')
print(sorted(colors_considered))
 3.4: Set basics 541016.3900880.9329y7 Jump to level 1 Set colors_considered is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!