Question: 2 . favorite colors Create a function in your dictionary.py file called favorite _ color. It has the following specifications: It takes as input a

2. favorite colors
Create a function in your dictionary.py file called favorite_color. It has the following specifications:
It takes as input a dict[str, str] of names and favorite colors.
It returns a str which is the color that appears most frequently.
If there is a tie for most popular color, return the color that appeared in the dictionary first.
Function name: favorite_colors
Parameter: dict[str, str]- dictionary of names and favorite colors
Return Type: str - the most popular color
An example:
>>> favorite_color({"Marc": "yellow", "Ezri": "blue", "Kris": "blue"}) blue

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 Programming Questions!