Skip to content
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

finished work #130

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

finished work #130

wants to merge 3 commits into from

Conversation

mxlZUBENKO
Copy link

No description provided.

2_if2.py Outdated
return 3
elif len(str_1) > len(str_2):
return 2
else:
Copy link

Choose a reason for hiding this comment

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

Если убрать блок else и делать после if return, у нас порядок исполнения кода не поменяется, а код станет чуть проще (менее вложенный, меньше блоков)

3_for.py Outdated
a_sale += 1
total_sales += sale
average_sales += 1
print(f'суммарное количество продаж {phone}: {total_sales}, среднее количество продаж {phone}: {total_sales // average_sales}')
Copy link

Choose a reason for hiding this comment

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

Как правило большого пальца, давай будем разделять "посчитать", "подготовить сообщение" и вывести.
Давай сделаем так что бы функция возвращала набор чисел
return phone, total_sales, average_sale

3_for.py Outdated

def main(sales_figures):
total_sales = average_sales = 0
for i in sales_figures:
Copy link

Choose a reason for hiding this comment

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

Все что в for происходит можно вынести отдельную функцию

3_for.py Outdated
pass

def main(sales_figures):
total_sales = average_sales = 0
Copy link

Choose a reason for hiding this comment

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

Более привычный вариант

Suggested change
total_sales = average_sales = 0
total_sales, average_sales = 0, 0

7_exception2.py Outdated
max_discount = abs(int(max_discount))
if max_discount >= 100:
raise ValueError('Слишком большая максимальная скидка')
if discount >= max_discount:
Copy link

Choose a reason for hiding this comment

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

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

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