commit with homework - #170
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Вот тут - неправильный расчет общего среднего.... Посмотри и прикинь, почему оно в 12 раз больше, чем нужно
There was a problem hiding this comment.
а т.е. сначала посчитать среднее всех продаж по каждому товару и потом сложить
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| while True: | ||
| answer = input("Задай свой вопрос:") |
There was a problem hiding this comment.
Тут некорректно выбрано имя переменной. Переменная - anwser - что переводится как ответ, а по факту в ней вопрос. Ее нужно было назвать "question"
There was a problem hiding this comment.
тут я немного сам уже не понимаю. В переменной ответ от пользователя или я не прав?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| raise ValueError('Слишком большая максимальная скидка') | ||
| return price - (price * discount / 100) | ||
| except (ValueError, TypeError): | ||
| print('Переданы некорректные аргументы или не сработало приведение типов данных!') |
There was a problem hiding this comment.
Код работает, но есть некоторая неопределенность. Непонятно где проблема преобразования. Лучше сделать обработчики на каждом преобразовании и написать какой именно параметр некорректный
There was a problem hiding this comment.
разделил, но все равно остались вопросы
| def get_constellation(update, context): | ||
| try: | ||
| user_planet = update.message.text.split()[1].lower() |
There was a problem hiding this comment.
Вот тут ты обрабатываешь исключение IndexError. Это хорошо
И тут вижу приведение к нижнему регистру. Это хорошо
There was a problem hiding this comment.
а я сделал исключение вот так:
except IndexError:
update.message.reply_text('ERROR! You do not determine the planet')
плохое решение?
Uh oh!
There was an error while loading. Please reload this page.
No description provided.