Skip to content

first commit - #1

Open
evalx95-spec wants to merge 2 commits into
mainfrom
develop
Open

first commit#1
evalx95-spec wants to merge 2 commits into
mainfrom
develop

Conversation

@evalx95-spec

Copy link
Copy Markdown
Owner

No description provided.

Comment thread task_3.py Outdated
def __init__(self):
self.points = 0

def get_points_for_place(self, place):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_points_for_place и get_points_for_meters лучше сделать статичными

Comment thread task_3.py Outdated
def get_points_for_place(self, place):
if place > 100:
print('Баллы начисляются только первым 100 участникам')
return self.points

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь переменная points должна быть локальной, а не перезаписываться как атрибут.
иначе сейчас возможна такая ситуация:

tp = TotalPoints()
tp.get_points_for_place(150)  # Ошибка, возвращает self.points (0)
tp.get_points_for_place(10)   # Возвращает 91
tp.get_points_for_place(200)  # Ошибка, возвращает 91 (а должно быть 0!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants