Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1: MLB All Star It's October, which means its baseball playoffs season! In this exercise, let's utilize dictionaries to see if we can model
Question 1: MLB All Star It's October, which means its baseball playoffs season! In this exercise, let's utilize dictionaries to see if we can model and learn more about some of our favorite players. In this problem, you will be implementing multiple functions. As you can see within your hw06.py file, the dictionaries mapping players to their team and statistics respectively have been created already. However, instead of accessing these values directly, we'll be implementing two functions to retrieve the appropriate values as a layer of abstraction Implement the get_team and get_stats functions to retrieve the team or statistics given a player's name full_roster "Manny Machado" : "Dodgers", "Yasiel Puig" "Dodgers", "Aaron Judge" "Yankees", "Clayton Kershaw "Dodgers", "Giancarlo Stanton" Yankees" full_stats- "Manny Machado": ["S0", "1B" , "", "SO" , "HR"], "Yasiel Puig": ["", "" , "18", "18", "S0"], "Aaron Judge": ["so", "HR", "HR", "1B", "so"], "Clayton Kershaw": ["1B", "S0", "sO", "1B", "So"], "Giancarlo Stanton":["HR", "SO", "3B", "SO", "2B", def get_team (player): "Returns team that the provided player is a member of. >>get team("Manny Machado") Dodgers >get_team("Aaron Judge") Yankees YOUR CODE HERE " return def get_stats (player): "Returns the statistics associated with the provided player. >get_stats("Manny Machado") >get_stats( 'Aaron Judge') YOUR CODE HERE " return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started