-
Notifications
You must be signed in to change notification settings - Fork 444
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
base: master
Are you sure you want to change the base?
My-homework #128
Conversation
if __name__ == "__main__": | ||
main() | ||
try: | ||
if __name__ == "__main__": |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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": |
There was a problem hiding this comment.
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__": |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в блок try лучше оборачивать те строки где ожидается ошибка, а не весь код
My-homework-1