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

My-homework #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

My-homework #128

wants to merge 1 commit into from

Conversation

KpoDja
Copy link

@KpoDja KpoDja commented Feb 15, 2023

My-homework-1

if __name__ == "__main__":
main()
try:
if __name__ == "__main__":

Choose a reason for hiding this comment

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

вот эту строчку оборачивать в try не нужно

pass


if type(str_one) != str and type(str_two) != str:

Choose a reason for hiding this comment

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

лучше тип проверять через isinstance



if type(str_one) != str and type(str_two) != str:
print(0)

Choose a reason for hiding this comment

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

Надо возвращать значения, а не печатать их

print(0)
elif str_one == str_two:
print(1)
elif str_one != str_two and len(str_one) > len(str_two):

Choose a reason for hiding this comment

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

а тут разве нужна первая чать условия?

print(1)
elif str_one != str_two and len(str_one) > len(str_two):
print(2)
elif str_one != str_two and str_two == "learn":

Choose a reason for hiding this comment

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

и вот тут тоже?

print(3)


if __name__ == "__main__":

Choose a reason for hiding this comment

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

Обычно это блок один и уже внутри можно вызвать функцию main столько сколько нужно


avg_scores_sum = 0

for one_mark in phones:

Choose a reason for hiding this comment

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

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


try:
if __name__ == "__main__":
main()

Choose a reason for hiding this comment

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

main надо же с аргументом вызывать

Надо вспомогательную функцию на 26 строке назвать по-другому, а остальной код положить в main

break
else:
print("Ну скажи 'Хорошо'?")
return hello_user()

Choose a reason for hiding this comment

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

а без рекурсии как сделать?



def discounted(price, discount, max_discount=20):
try:

Choose a reason for hiding this comment

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

в блок try лучше оборачивать те строки где ожидается ошибка, а не весь код

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