Question: 3 . 4 : Set basics 5 4 1 0 1 6 . 3 9 0 0 8 8 0 . 9 3 2 9
: Set basics
Jump to level
Set colorsconsidered is initialized with four colors read from input. Assign numcolors with the number of elements in colorsconsidered. Then, clear colorsconsidered.
Click here for example
Ex If the input is:
aqua
blue
maroon
red
then the output is:
Number of values considered:
Note: Because sets are unordered, the set is printed using the sorted function here for comparison.
colorsconsidered set
newcolor input
newcolor input
newcolor input
newcolor input
colorsconsidered.addnewcolor
colorsconsidered.addnewcolor
colorsconsidered.addnewcolor
colorsconsidered,addnewcolor
I Your code goes here
print fNumber of values considered: numcolors
printsortedcolorsconsidered
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
