subject

LAB: Winning team (classes) Complete the Team class implementation. For the class method get_win_percentage(), the formula is:
team_wins / (team_wins + team_losses)
Note: Use floating-point division.
Ex: If the input is:
Ravens
13
3
where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is:
Congratulations, Team Ravens has a winning average!
If the input is Angels 80 82, the output is:
Team Angels has a losing average.

We are given:
class Team:
def __init__(self):
self. team_name = 'none'
self. team_wins = 0
self. team_losses = 0
# TODO: Define get_win_percentage()
if __name__ == "__main__":
team = Team()
team_name = input()
team_wins = int(input())
team_losses = int(input())
team. set_team_name(team_name)
team. set_team_wins(team_wins)
team. set_team_losses(team_losses)
if team. get_win_percentage() >= 0.5:
print('Congratulations, Team', team. team_name,'has a winning average!')
else:
print('Team', team. team_name, 'has a losing average.')
Please help, in Python!

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:10
Write a method that accepts a string object as an argument and returns the number of words it contains. for instance, if the argument is "four score and seven years ago", the method should return the number 6. demonstrate the method in a program that asks the user to input a string and then passes that string into the method, printing out whatever the method returns.
Answers: 3
question
Computers and Technology, 22.06.2019 05:10
Read the code below. what will the computer print if the input for year_variable is 1700? if year_variable == 1776: print("your answer is correct. the declaration of independence was signed in “year_variable”.") elif year_variable < 1776: compute_variable = 1776 - year_variable. print("add “compute_variable“ years to your answer for the correct answer.") elif year_variable > 1776: compute_variable = year_variable - 1776 print("subtract “compute_variable” years from your answer for the correct answer.")
Answers: 1
question
Computers and Technology, 22.06.2019 17:30
1. before plugging in a new device to a computer you should unplug all other devices turn off the computer turn on the computer 2. many of the maintenance tools for a computer can be found in the control panel under administrative tools display personalization
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
You know the right answer?
LAB: Winning team (classes) Complete the Team class implementation. For the class method get_win_pe...
Questions
question
Mathematics, 12.02.2021 07:40
question
Mathematics, 12.02.2021 07:40
question
Health, 12.02.2021 07:40
question
Social Studies, 12.02.2021 07:40
question
Mathematics, 12.02.2021 07:40
question
Mathematics, 12.02.2021 07:40
question
Mathematics, 12.02.2021 07:40
question
History, 12.02.2021 07:40
Questions on the website: 13722363