Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I wanna python Expert Solutions Use Python Create a class called Team. The class should contain the following attributes name . league . city *
I wanna python Expert Solutions
Use Python
Create a class called Team. The class should contain the following attributes name . league . city * country managerName . conference - This refers to the international governing body under which the team plays, e.g. UEFA, CAF, ICC East Asia-Pacific, etc. All of these attributes should be required in the__init__function. Note part of the beauty of Python - because types are dynamic and inferred, none of the code of Player class needs to be changed even though Team is now a class and not a string Add a list or other data structure for teams in the module: teams and initialize it with Team objects appropriate to the players you defined in the previous lab. You will need to add this earlier in the module than the__players definition. Implement a function addTeam () analogous to addPlayer () from the previous lab Change the player objects to use the teams you have just defined rather than the strings from the previous lab. Ensure that you are re-using the teams you have already defined by fetching them from_teams rather than redefining them. Create a class called Match. The class should contain the following instance attributes homeTeam awayTeam date homeScores awayScores of note are homeScores and awayScores, which should be Python dict objects containing a map from Player full name (firstName and lastName) to a tuple (player,score). Note: this is not a clean or efficient way to do this, but using objects as dictionary keys in Python requires them to support specific properties which we won't go over just yet. Extra credit for those who improve this implementation, either by using Player objects as keys, or through some other means Create a class called Team. The class should contain the following attributes name . league . city * country managerName . conference - This refers to the international governing body under which the team plays, e.g. UEFA, CAF, ICC East Asia-Pacific, etc. All of these attributes should be required in the__init__function. Note part of the beauty of Python - because types are dynamic and inferred, none of the code of Player class needs to be changed even though Team is now a class and not a string Add a list or other data structure for teams in the module: teams and initialize it with Team objects appropriate to the players you defined in the previous lab. You will need to add this earlier in the module than the__players definition. Implement a function addTeam () analogous to addPlayer () from the previous lab Change the player objects to use the teams you have just defined rather than the strings from the previous lab. Ensure that you are re-using the teams you have already defined by fetching them from_teams rather than redefining them. Create a class called Match. The class should contain the following instance attributes homeTeam awayTeam date homeScores awayScores of note are homeScores and awayScores, which should be Python dict objects containing a map from Player full name (firstName and lastName) to a tuple (player,score). Note: this is not a clean or efficient way to do this, but using objects as dictionary keys in Python requires them to support specific properties which we won't go over just yet. Extra credit for those who improve this implementation, either by using Player objects as keys, or through some other means
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