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

commit with homework #170

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

Conversation

aka-nomad
Copy link

No description provided.

1_if1.py Show resolved Hide resolved
2_if2.py Outdated Show resolved Hide resolved
2_if2.py Outdated Show resolved Hide resolved
2_if2.py Show resolved Hide resolved
3_for.py Outdated Show resolved Hide resolved
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.

верно сделал?

4_while1.py Show resolved Hide resolved
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.

тут я немного сам уже не понимаю. В переменной ответ от пользователя или я не прав?

5_while2.py Outdated Show resolved Hide resolved
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')
плохое решение?

2_if2.py Outdated Show resolved Hide resolved
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