-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #1348
base: master
Are you sure you want to change the base?
Develop #1348
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the task requirements! 🎉 The code is mostly correct and meets the core requirements. There are a couple of minor improvements you could consider: correcting the typo from hummer_level
to hammer_level
in the DwarfWarrior
class and optimizing the calculate_team_total_rating
function by using a generator expression. Keep up the good work and happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
|
||
def calculate_team_total_rating(team: list[Player]) -> int: | ||
return sum([player.get_rating() for player in team]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculate_team_total_rating
function uses a list comprehension inside the sum
function, which creates a redundant list. According to the checklist, you should prevent creating a redundant list by using a generator expression instead. Change [player.get_rating() for player in team]
to (player.get_rating() for player in team)
to improve efficiency .
class DwarfWarrior(Dwarf): | ||
def __init__(self, nickname: str, | ||
favourite_dish: str, | ||
hummer_level: int) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name hummer_level
. It should likely be hammer_level
to reflect the intended meaning. This change should be applied consistently throughout the class.
favourite_dish: str, | ||
hummer_level: int) -> None: | ||
super().__init__(nickname, favourite_dish) | ||
self._hummer_level = hummer_level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute _hummer_level
seems to have a typo. It should likely be _hammer_level
to reflect the intended meaning.
self._hummer_level = hummer_level | ||
|
||
def get_rating(self) -> int: | ||
return self._hummer_level + 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute _hummer_level
seems to have a typo. It should likely be _hammer_level
to reflect the intended meaning.
|
||
def player_info(self) -> str: | ||
return (f"Dwarf warrior {self.nickname}. " | ||
f"{self.nickname} has a hummer of the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word hummer
in the string should likely be hammer
to reflect the intended meaning.
No description provided.