Skip to content

Conversation

@dimamushalapugin
Copy link

No description provided.

"""
pass
age = int(input('Введите ваш возраст: '))
if 0 <= age < 7:
Copy link

Choose a reason for hiding this comment

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

Вынеси if-ы в отдельную функцию, так что бы она принимала int на вход и ВСЕГДА возвращала строку.

pass

string_1, string_2 = input('Введите данные:'), input('Введите данные:')
if not string_1.isalpha() and not string_2.isalpha():
Copy link

Choose a reason for hiding this comment

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

Этот код поломается как только будет передана не строка.
Тут надо было проверять с isinstance(string_1, str)

"""
pass

string_1, string_2 = input('Введите данные:'), input('Введите данные:')
Copy link

Choose a reason for hiding this comment

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

функция должна принимать два объекта как аргументы.
Объяви функцию (перед main) и вызывай ее в main()

return 'eRRor'
try:
price = abs(price)
except:
Copy link

Choose a reason for hiding this comment

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

обязательно указываем что именно мы хотим перехватить
без указания мы пытаемся перехватить вообще все (даже KeyboardInterrupt)

except:
discount = abs(discount)
try:
max_discount = abs(max_discount)
Copy link

Choose a reason for hiding this comment

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

Слишком длинный блок try, желательно что бы в try была одна строчка. Тут исключение может быть или в abs, или там где мы сами его бросаем. Поменяй raise на return строки просто.

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