Question

Write a Python program to manage league matches. Different teams can participate in a league. A...

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.

Homework Answers

Answer #1

1). ANSWER :

GIVENTHAT :

Here is the code for the following question however if you feel any doubt please feel free to ask.

Code:

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()

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a Java program segment (not an entire program) that will summarize the season results for...
Write a Java program segment (not an entire program) that will summarize the season results for 5 players on one of TRU’s basketball teams. Each player played 10 games. Your program segment should ask the user for a player’s name, followed by the points that player scored in each of the 10 games (a total of 11 pieces of input). Your program will then produce the summary line shown below for that player.   Your program should get the data for...
Basketball is one of the most popular sports in the United States. Basketball tournaments consist of...
Basketball is one of the most popular sports in the United States. Basketball tournaments consist of games between two teams at various stages (league, playoff, final, etc.). Each individual game in the tournament is played between two competing teams played at a specific city or stadium with a certain capacity, and attended by a number of spectators. The matches may also be televised on a TV channel, and viewed by an estimated number of TV viewers. During each match, the...
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional...
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional char array with three rows and three columns as the game board. Each element in the array should be initialized with an asterisk (*). The program should run a loop that: • Displays the contents of the board array. • Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and...
Implement the following problem as a self-contained Python program (module). Please write in beginner level code!...
Implement the following problem as a self-contained Python program (module). Please write in beginner level code! Thanks! The game of Pig is a simple two-player dice game in which the first player to reach 100 or more points wins. Players take turns. On each turn, a player rolls a six-sided die. After each roll: a) If the player rolls a 1 then the player gets no new points and it becomes the other player’s turn. b) If the player rolls...
The International League of Triple-A minor league baseball consists of 14 teams organized into three divisions:...
The International League of Triple-A minor league baseball consists of 14 teams organized into three divisions: North, South, and West. The following data show the average attendance for the 15 teams in the International League. Also shown are the teams’ records; W denotes the number of games won, L denotes the number of games lost, and PCT is the proportion of games played that were won. A test for any difference in the mean attendance for the three divisions has...
The International League of Triple-A minor league baseball consists of 14 teams organized into three divisions:...
The International League of Triple-A minor league baseball consists of 14 teams organized into three divisions: North, South, and West. The following data show the average attendance for the 15 teams in the International League. Also shown are the teams’ records; W denotes the number of games won, L denotes the number of games lost, and PCT is the proportion of games played that were won. A test for any difference in the mean attendance for the three divisions has...
Use python to write the code You’re going to program a simulation of the following game....
Use python to write the code You’re going to program a simulation of the following game. Like many probability games, this one involves an infinite supply of ping-pong balls. No, this game is "not quite beer pong." The balls are numbered 1 through N. There is also a group of N cups, labeled 1 through N, each of which can hold an unlimited number of ping-pong balls (all numbered 1 through N). The game is played in rounds. A round...
   Dice Game – Accumulator Pattern and Conditionals (40 pts) IN PYTHON Write a program dicegame.py...
   Dice Game – Accumulator Pattern and Conditionals (40 pts) IN PYTHON Write a program dicegame.py that has the following functions in the following order: in python Write a function roll that takes an int n and returns a random number between 1 and n inclusive. Note: This function represents a n sided die so it should produce pseudo random numbers. You can accomplish this using the random module built into python.         (3 pts) Write a function scoreRound that...
Problem 12-09 The Iowa Energy are scheduled to play against the Maine Red Claws in an...
Problem 12-09 The Iowa Energy are scheduled to play against the Maine Red Claws in an upcoming game in the National Basketball Association Developmental League (NBA-DL). Because a player in the NBA-DL is still developing his skills, the number of points he scores in a game can vary dramatically. Assume that each player's point production can be represented as an integer uniform variable with the ranges provided in the table below. Player Iowa Energy Maine Red Claws 1 [5, 20]...
You are coding a simple game called Pig. Players take turns rolling a die. The die...
You are coding a simple game called Pig. Players take turns rolling a die. The die determines how many points they get. You may get points each turn your roll (turn points), you also have points for the entire game (grand points). The first player with 100 grand points is the winner. The rules are as follows: Each turn, the active player faces a decision (roll or hold): Roll the die. If it’s is a: 1: You lose your turn,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT