-
Notifications
You must be signed in to change notification settings - Fork 444
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
base: master
Are you sure you want to change the base?
finished work #130
Conversation
2_if2.py
Outdated
return 3 | ||
elif len(str_1) > len(str_2): | ||
return 2 | ||
else: |
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.
Если убрать блок 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}') |
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.
Как правило большого пальца, давай будем разделять "посчитать", "подготовить сообщение" и вывести.
Давай сделаем так что бы функция возвращала набор чисел
return phone, total_sales, average_sale
3_for.py
Outdated
|
||
def main(sales_figures): | ||
total_sales = average_sales = 0 | ||
for i in sales_figures: |
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.
Все что в for происходит можно вынести отдельную функцию
3_for.py
Outdated
pass | ||
|
||
def main(sales_figures): | ||
total_sales = average_sales = 0 |
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.
Более привычный вариант
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: |
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.
я бы ожидал тут не строгое неравенство, что бы 20 процентов можно было использовать.
No description provided.