-
Notifications
You must be signed in to change notification settings - Fork 450
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
commit with homework #170
base: master
Are you sure you want to change the base?
commit with homework #170
Conversation
3_for.py
Outdated
|
||
print(f"{item}, Total amount of sale: {sum_of_sale}, Average number of sale:{average_sale}") | ||
|
||
print(f"All items total sales: {total_sale}, All items average sales: {total_sale // len(product_sell)}") |
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.
Вот тут - неправильный расчет общего среднего.... Посмотри и прикинь, почему оно в 12 раз больше, чем нужно
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 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 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.
верно сделал?
5_while2.py
Outdated
|
||
while True: | ||
answer = input("Задай свой вопрос:") |
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.
Тут некорректно выбрано имя переменной. Переменная - anwser - что переводится как ответ, а по факту в ней вопрос. Ее нужно было назвать "question"
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.
тут я немного сам уже не понимаю. В переменной ответ от пользователя или я не прав?
7_exception2.py
Outdated
raise ValueError('Слишком большая максимальная скидка') | ||
return price - (price * discount / 100) | ||
except (ValueError, TypeError): | ||
print('Переданы некорректные аргументы или не сработало приведение типов данных!') |
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 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.
разделил, но все равно остались вопросы
|
||
def get_constellation(update, context): | ||
try: | ||
user_planet = update.message.text.split()[1].lower() |
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.
Вот тут ты обрабатываешь исключение IndexError. Это хорошо
И тут вижу приведение к нижнему регистру. Это хорошо
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.
а я сделал исключение вот так:
except IndexError:
update.message.reply_text('ERROR! You do not determine the planet')
плохое решение?
No description provided.