-
Notifications
You must be signed in to change notification settings - Fork 55
HW2_Zherko #4
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
base: main
Are you sure you want to change the base?
HW2_Zherko #4
Conversation
Add function main
Add function main
Add divide function
Add division function
Add subtraction function
Add function multilply
Hw2 erofeeva
Add information about our team
| @@ -0,0 +1,34 @@ | |||
| def multiply(a, b): | |||
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.
Возможно, стоит использовать более информативный нейминг переменных, например num_1, num_2. На оценку это не повлияет, разумеется, но в будущем стоит обратить внимание :)
| return a - b | ||
|
|
||
| def main(): | ||
| expression = input("Введите математическое выражение: ") |
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.
Юзабилити +++
| else: | ||
| print("Неверный оператор") | ||
| return | ||
| print(f"Результат: {result:.2f}") |
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.
Лучше это сделать через return, иначе получается, что функция ничего не возвращает. print()-ом как раз мы хотим выводить на экран результат работы функции. Без return результат работы калькулятора невозможно будет использовать в дальнейшем коде.
| print("Неверный оператор") | ||
| return |
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.
Здорово, что предусмотрено взаимодействие с пользователем в случае неверного оператора.
Не очень здорово, что return пустой, и функция будет возвращать None
| else: | ||
| print("Неверный оператор") | ||
| return | ||
| print(f"Результат: {result:.2f}") |
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(f"Результат: {result:.2f}") | |
| return result |
| print("Неверный оператор") | ||
| return | ||
| print(f"Результат: {result:.2f}") | ||
| 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() | |
| if __name__ == "__main__": | |
| main() |
Лучше использовать такую конструкцию (но это вас ещё ждёт впереди)
|
|
||
| def main(): | ||
| expression = input("Введите математическое выражение: ") | ||
| number1, operator, number2 = expression.split() |
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.
Хорошая распаковка и нейминг переменных!
| number1, operator, number2 = expression.split() | ||
| number1 = float(number1) | ||
| number2 = float(number2) | ||
| result = None |
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.
Хорошо задана переменная result
| 3. Мухаметшина Регина - divide() | ||
| 4. Жерко Никита - add() | ||
| 5. Ерофеева Наталья - subtract() | ||
|
|
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.
Хотелось бы тут видеть примеры использования программы, что она получает на вход, что она выдаёт на выходе. Условному пользователю лучше сразу понимать, как с ней взаимодействовать.
В частности, в README указаны названия всех реализованных функций, но не написано, что их названия являются единственно рабочими операторами (а это не очевидно!)
Но хорошо, что указан состав команды, кто какую функцию реализовал. Фото 🔥
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.
Хорошая работа!
Если учесть небольшие исправления по мелочам, то вообще всё будет супер.
Оценка:
Функции: 1.6 * 5 = 8
Ветки и пулл-реквесты: 1 балл
README: 0.6
Доп. балл за фото: 1
Итог: 10.6
No description provided.