Status: Not Started
- scratchpad.py
- Unit Test
Font Size
14
Parentheses autocomplete
Wrap lines
Editor
Theme
Code with blocks by default
Console Font Size
12
Console Theme
Display Server Graphics Screen
Show File Tab Bar
Debug Mode
Fun With Friends
Unit Test
1
2
def most_popular_activity(friend_activities):
return
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output
Grading
Docs
Exercise
More
History
Video
Download
About
W
Test Cases
x/x
Pass | Test | Message | |
---|---|---|---|
- | Test results will show here. | - |
Errors:
This student is viewing this assignment in English. View this page in English?
5 points
You and your friends are planning on all hanging out! Everyone has different interests and ideas on what to do. Based on everyone’s list of ideas, find the most popular idea(s) so everyone will be happy.
Write a function that takes in a dictionary where:
- The keys are the names of your friends.
- The values are lists of activities each friend suggested.
The function should return a list of the activities that appear the most in the lists. If there is a tie for the most popular activity, return all activities that are tied.
Example:friend_activities = {
"Alice": ["movie", "hiking", "bowling"],
"Bob": ["hiking", "movie", "swimming"],
"Charlie": ["movie", "bowling", "tennis"]
}
# The activity "movie" appears 3 times, which is the most.
# "hiking" and "bowling" appear 2 times each.
# So, the function should return ["movie"] as it's the most popular.
Python
Reset Code
Upload an image
Upload from your computer
Or paste a link here
Slides and Notes
No slides available for this video
About
Python 3 Practice
3.11.9 (default, Apr 6 2024, 17:59:24)
[GCC 6.4.0]