Question: Kindly code this in python Q 7) Using the data given below to create a class team which has the following attributes and methods: a)

Kindly code this in python Q 7) Using the data given belowto create a class team which has the following attributes and methods:Kindly code this in python

Q 7) Using the data given below to create a class team which has the following attributes and methods: a) Attributes: name, league, nation, players(list of class players) b) Methods: add_player, get_player c) constructor should take name, league, nation as input and initialize the attributes. Now create a class player which has the following attributes and methods: a) Attributes: name, age, goals b) Methods: get_age, get_name c) Constructor should take name, age, goals as input and initialize the attributes. Finally create a dictionary of teams where key is a random number and value is an object of class team. Also add the play the the the the add_player method. [Python Class] import random leagues_data =[ 'Premier League', 'La Liga', 'Serie A', 'Bundesliga', 'Ligue 1'] nation_data =[ 'England', 'Spain', 'Italy', 'Germany', 'France'] teams_data =[ 'Liverpool', 'Barcelona', 'Juventus', 'Bayern Munich', 'Paris Saint-Germain'] players_data =[ 'Mohamed Salah', 'Lionel Messi', 'Cristiano Ronaldo', 'Robert Lewandowski', 'Kylian Mbappe'] goals_data =[22,36,50,34,18] age_data =[27,32,34,31,20] \# create a class team class team: \#write your code here pass \# create a class player class player: \# write your code here pass \#create a dictionary of teams teams = \{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!