Skip to content

HW2_Stepanova#12

Open
arrstepa wants to merge 19 commits intoPython-BI-2025-26:mainfrom
arrstepa:HW2_Stepanova
Open

HW2_Stepanova#12
arrstepa wants to merge 19 commits intoPython-BI-2025-26:mainfrom
arrstepa:HW2_Stepanova

Conversation

@arrstepa
Copy link

Отправляем вам наш калькулятор. Мы старались.

Copy link

@eksytnik eksytnik left a comment

Choose a reason for hiding this comment

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

Хорошая работа!
На будущее стоит быть внимательнее с отступами в коде, это супер влияет на читаемость. Коммиты отличные, видна живая работа - и при этом по делу сообщения.

Баллы: 10/10 (README) + 10/10 (ветки) + 79/80 (код и коммиты) + 10 доп. =
= 99/100 + 10 доп.

(тимлид, не забудь показать ревью всей команде)

Comment on lines +1 to +3
def multiple(a,b):
"Функция умножения двух чисел"
return a*b

Choose a reason for hiding this comment

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

Suggested change
def multiple(a,b):
"Функция умножения двух чисел"
return a*b
def multiplication(a, b):
"Функция умножения двух чисел"
return a * b

Choose a reason for hiding this comment

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

На будущее - все описания и комментарии стоит писать на английском.

"Функция умножения двух чисел"
return a*b

def substraction(a, b):

Choose a reason for hiding this comment

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

Однобуквенные переменные стоит оставить только для счетчиков. Хорошо бы подошло num1, num2, или что-то еще подобное.

Comment on lines +13 to +18
def division (a, b):
"Функция деления a на b"
if b!= 0:
return a/b
else:
return "деление на 0!"

Choose a reason for hiding this comment

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

Suggested change
def division (a, b):
"Функция деления a на b"
if b!= 0:
return a/b
else:
return "деление на 0!"
def division (a, b):
"Функция деления a на b"
if b != 0:
return a / b
else:
return "деление на 0!"

Choose a reason for hiding this comment

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

Здорово, что про проверку подумали. Про ошибки и работу с ними еще поговорим, но пока как базовое правило - в большинстве случаев функция должна возвращать возвращать один ожидаемый тип данных. Иногда - тот тип данных, который ей дали. Но функция, которая что-то считает, не должна отдавать строку просто так. Просто запомнить пока что!

Comment on lines +20 to +30
def main():
exp=input("Введите выражение: ").split()
a,operation,b = float(exp[0]), exp[1], float(exp[2])
if operation == "+":
print(addition(a,b))
elif operation == "-":
print(substraction(a,b))
elif operation == "*":
print(multiple(a,b))
else:
print(division(a,b))

Choose a reason for hiding this comment

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

Suggested change
def main():
exp=input("Введите выражение: ").split()
a,operation,b = float(exp[0]), exp[1], float(exp[2])
if operation == "+":
print(addition(a,b))
elif operation == "-":
print(substraction(a,b))
elif operation == "*":
print(multiple(a,b))
else:
print(division(a,b))
def main():
exp = input("Введите выражение: ").split()
a, operation, b = float(exp[0]), exp[1], float(exp[2])
if operation == "+":
print(addition(a, b))
elif operation == "-":
print(substraction(a, b))
elif operation == "*":
print(multiple(a, b))
else:
print(division(a, b))


def main():
exp=input("Введите выражение: ").split()
a,operation,b = float(exp[0]), exp[1], float(exp[2])

Choose a reason for hiding this comment

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

Здорово, что сразу так сделано, в одну строку - в таких случаях это крайне уместно.

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.

5 participants