Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribedimage text in transcribedKindly 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions