Question: Write a function that takes a dictionary, where the keys are strings (name of a team) and values are lists of strings, representing team
Write a function that takes a dictionary, where the keys are strings (name of a team) and values are lists of strings, representing team members. The function also takes another non-negative integer, limit, indicating the allowed team size. Your function should return a list, where the items are only the keys of the teams with enough people to practice. Requirement: You cannot NOT use loops and list comprehension for this question. Instead, you must use lambda, map and/or filter functions. There are no restrictions on the number of lines, but our solution is one line. def joint practice_2 (teams, limit): >>> teams = {"team1": ["A", "B", "C"], "team2": ["D", "E"]} >>> joint_practice_2 (teams, 3) ['team1'] >>> joint_practice_2(teams, 4) [] >>> joint_practice_2 (teams, 0) ['teaml', 'team2'] >>> joint practice_2({}, 3) [] 11 11 11
Step by Step Solution
There are 3 Steps involved in it
You can achieve this with a oneliner function using the filter and lambda functions Heres the code ... View full answer
Get step-by-step solutions from verified subject matter experts
