Question: Write a function teams_by_state (player_team, team_city, city_state) that on input a dictionary player_team that maps the name of an NBA player to his team, a

Write a function teams_by_state (player_team, team_city, city_state) that on input a dictionary player_team that maps the name of an NBA player to his team, a dictionary team_city that maps an NBA team to its city, and a dictionary city_state that maps a city to its state, computes and returns a dictionary where every key is a state, and its value is another dictionary that maps a team in the state to a list consisting of the names of the players on the team. Assume that every team that is a value in the dictionary player_team appears as a key in the dictionary team_city, and every city that is a value in the dictionary team_city appears as a key in the dictionary city_state. In [19]: def teams_by_state (player_team, team_city, city_state): Args : player_team (dict {str, str}): A dictionary mapping the name of a player to his team team_city (dict {str, str}): A dictionary mapping a team to its city city_state (dict {str, str}): A dictionary mapping a city to its state Returns: dict {str, dict {str, list[str]}}: A dictionary where every key is a state, and its value is another dictionary that maps a team in the state to a list consisting of the names of the players on the team # Your code here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
