Skip to content

HW2_Stepanova#21

Open
Stepanovalera wants to merge 31 commits intoPython-BI-2024-25:mainfrom
Stepanovalera:HW2_Stepanova
Open

HW2_Stepanova#21
Stepanovalera wants to merge 31 commits intoPython-BI-2024-25:mainfrom
Stepanovalera:HW2_Stepanova

Conversation

@Stepanovalera
Copy link

No description provided.

Stepanovalera and others added 30 commits September 19, 2024 14:28
Regadene => Stepanovalera pull request
добавлена функция end()
Добавили Наталью в авторы программы.
Copy link

@iam28th iam28th left a comment

Choose a reason for hiding this comment

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

приветствую!

замечательная работа, очень понравилось как вы логику разбили и что сделали цикл для произвольного числа вычислений, накинул +2 доп. бала.
по коду есть некоторое количество незначительных (на текущем этапе:) недочётов

пожалуй что единственный существенный момент - сообщения коммитах должны быть на английском, -5б.
остальное всё здорово.

итого у вас 95 + 12/100 баллов за эту работу.

return True
break
else:
print('Неподходящий ответ')
Copy link

Choose a reason for hiding this comment

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

огонь!

зачем вам break после return?)

if b != 0:
return a / b
else:
return "Ошибка: Деление на ноль!"
Copy link

Choose a reason for hiding this comment

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

круто, что вспомнили про особый случай с делением!
при этом сам питон об этом тоже помнит, и напечатает вам ZeroDivisionError с понятным сообщением и traceback-ом
т.е. зачастую (правда обычно в достаточно тривиальных случаях) можно самим с ошибками не заморачиваться и делегировать всё это питону

Choose a reason for hiding this comment

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

Здравствуйте, Артём!
Спасибо за проверку и замечания :)

Comment on lines +21 to +22
exp = (input("Введите выражение: "))
return exp
Copy link

Choose a reason for hiding this comment

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

Suggested change
exp = (input("Введите выражение: "))
return exp
return input("Введите выражение: ")

a,oper,b=expression.split()
a=float(a)
b=float(b)
return(a,b,oper)
Copy link

Choose a reason for hiding this comment

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

круто, что вынесли это отдельно!
здесь только бы добавить пробелов вокруг операторов

#Реализует функцию end()
if end():
print('Конец программы')
break
Copy link

Choose a reason for hiding this comment

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

здесь хочется увеличить отступ у комментариев на ещё один уровень

Comment on lines +39 to +42
if b != 0:
return a / b
else:
return "Ошибка: Деление на ноль!"
Copy link

Choose a reason for hiding this comment

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

в случаях, когда обе ветки в if/else заканчиваются return-ом, обычно "экономят отступы":

Suggested change
if b != 0:
return a / b
else:
return "Ошибка: Деление на ноль!"
if b != 0:
return a / b
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.

4 participants