Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE PYTHON Part 1 1. The system you're building should, at minimum, know each player, what team he or she plays for, and some sense
USE PYTHON Part 1 1. The system you're building should, at minimum, know each player, what team he or she plays for, and some sense of his or her scoring. In the code box below, define three 1ist data structures called name list, team list, and score list. Then populate name list and team list with five (5) players in whatever sport field you wish your system to support. For example:name_list- ["Asamoah Gyan""Michael Essien""Didier Drogba""Emmanuel Adebayor", "Samuel Eto' o] team-list = ["Sunderland", "Chelsea", "Chelsea", "Man City", "Inter"] 2. Consider how you might store the information regarding scoring. For football, you could record total goals scored but that doesn't give you any information about whether the goal was for a club or national team, when it was scored, against whom, etc. Similarly for cricket, you could record total runs scored, or strike rate, but you would be missing much of the important information. For simplicity, assume you want to record some score (goals scored, runs scored, wickets taken, saves, etc.) and the date it occurred. You may implement this as you like, using tuples, dictionaries, or lists, as long as you can return the date as a datetime.date and the score value as an int 3. You now have the data for a very basic sport statistics program. The next step is to create functions that return the data you want when called. Implement the following functions: a. def highest scor returns the highest score by anyone in the system in a tuple: (player name, team, date of score, score). b. def highest score_for_player player returns the highest score by the supplied player in the same tuple as above, or None if the player is not in the system. Hint: You can find the index of an item in a list by using the index) function, e.g. T"a","b","c"].index("b"). You will, however, need to catch an exception if the item is not in the list, so it may be more straightforward to iterate. C. def highest_scorer returns the name of the player with the highest scoring sum, i.e. the total of all the goals/runs/etc. stored in the system. d def highest average_scorer returns the name of the player with the highest average, i.e the total of all the goals/runs/etc divided by the number of matches. e. def add score( player date, score adds a new score element to the score datastructure. Note that the date must be a datetime object and score must be an int. 4. Now imagine your application has caught the attention of a local web company who wants to use it for their sports reporting. However, the information provided has to be much deeper; in addition to scoring they want (using footbal as an example) things like dates with different teams, minutes played in each match, player birthdays and age, height, nationality, appearances, injuries, etc. This is, of course, represents many, many lists. Choose two additional statistics, of which one must be dynamic- i.e. changing as time passes - and add new data structures to hold their values. Also add functions to get and set these values
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