My code isn't working, I was wondering if it was my definition of print_standing?: class Team: def __init__(self): self.name = 'none' self.wins = 0 self.losses = 0 def get_win_percentage(self): return self.wins / (self.wins + self.losses) # TODO: Define print_standing() def print_standing(self): if float(self.get_win_percentage) > 0.5: print(f'{self.names} has a winning average') else: print(f'{self.names} has a loosing average') if __name__ == "__main__": team = Team() user_name = input() user_wins = int(input()) user_losses = int(input()) team.name = user_name team.wins = user_wins team.losses = user_losses team.print_standing()
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
My code isn't working, I was wondering if it was my definition of print_standing?:
class Team:
def __init__(self):
self.name = 'none'
self.wins = 0
self.losses = 0
def get_win_percentage(self):
return self.wins / (self.wins + self.losses)
# TODO: Define print_standing()
def print_standing(self):
if float(self.get_win_percentage) > 0.5:
print(f'{self.names} has a winning average')
else:
print(f'{self.names} has a loosing average')
if __name__ == "__main__":
team = Team()
user_name = input()
user_wins = int(input())
user_losses = int(input())
team.name = user_name
team.wins = user_wins
team.losses = user_losses
team.print_standing()

Step by step
Solved in 4 steps with 3 images









