Skip to content

Conversation

@aka-nomad
Copy link

No description provided.

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)}")

Choose a reason for hiding this comment

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

Вот тут - неправильный расчет общего среднего.... Посмотри и прикинь, почему оно в 12 раз больше, чем нужно

Copy link
Author

Choose a reason for hiding this comment

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

а т.е. сначала посчитать среднее всех продаж по каждому товару и потом сложить

Copy link
Author

Choose a reason for hiding this comment

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

поправил и пушнул

Copy link
Author

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("Задай свой вопрос:")

Choose a reason for hiding this comment

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

Тут некорректно выбрано имя переменной. Переменная - anwser - что переводится как ответ, а по факту в ней вопрос. Ее нужно было назвать "question"

Copy link
Author

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('Переданы некорректные аргументы или не сработало приведение типов данных!')

Choose a reason for hiding this comment

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

Код работает, но есть некоторая неопределенность. Непонятно где проблема преобразования. Лучше сделать обработчики на каждом преобразовании и написать какой именно параметр некорректный

Copy link
Author

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()
Copy link

@maxmokry maxmokry Sep 23, 2024

Choose a reason for hiding this comment

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

Вот тут ты обрабатываешь исключение IndexError. Это хорошо

И тут вижу приведение к нижнему регистру. Это хорошо

Copy link
Author

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')
плохое решение?

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