In: Computer Science
Write a Python program to manage league matches. Different teams can participate in a league. A player belongs to a team and a team can play many games in a league. For each team, the league wants to track the name of the team and the number of players in each team. The league also wants to track the number of games the team has played, and the total numbers of points scored across all games played. During each game, a team can score no points or a number of points represented by a whole number. Create a separate module to test the classes created with at-least 5 teams and display the matches played and the respective scores.
1 league
3 teams
5 players
3 game
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU
class Team:
#constructor which will initialize all required variable
def __init__(self, team_name, number_of_players, total_match, total_points):
self.team_name = team_name
self.number_of_players = number_of_players;
self.total_match = total_match
self.total_points = total_points
#this method will display the matches played by teams and their respective scores
def display_info(self):
print("Team : {0}\t Matches Played: {1}\t Score: {2}".format(self.team_name, self.total_match, self.total_points))
#creating 5 teams object
team1 = Team("Milan", 16, 24, 30)
team2 = Team("Manchester", 30, 120, 200)
team3 = Team("Bercilona", 20, 200, 190)
team4 = Team("Rial", 25, 90, 140)
team5 = Team("Uventus", 22, 80, 100)
#displaying all team info
team1.display_info()
team2.display_info()
team3.display_info()
team4.display_info()
team5.display_info()