-
Notifications
You must be signed in to change notification settings - Fork 56
Hw2 bredov #2
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 bredov #2
Conversation
add subtract function
add multiply to calculator.py
Add function add
add division
Add development crew photo ( ͡° ͜ʖ ͡°)
Perform spell check.
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.
Хорошая работа! Все что нужно сделали.
Оставил в коде некоторые замечания по оформлению. Они не критические, просто обратите на них внимание на будущее. Также некоторые сообщения коммитов можно было бы оформить чуть аккуратнее.
Например, два хороших вот такие у вас:
Если бы все были как эти - вообще красота.
Еще по коммитам - у вас в Initial commit добавлена функция main. Обычно Initial commit это когда вы создали пустой проект и еще ничего в нем не делали и вам нечего написать. У вас же тут добавлен очень большой и важный кусок функциональности.
В конце концов: очень круто что вы сделали через pattern matching а не просто if-elif.
Баллы:
- За каждую функцию: 1.6 * 5 = 8
- За README 1 + 1 доп. = 2
- За наличие всех форков и пулл-реквестов - 1 балл
- За pattern matching еще 0.2 доп. балла.
Итого: 11.2
Мерджить не надо, но стоит скинуть показать комментарии всем участникам команды
Молодцы!
@@ -0,0 +1,25 @@ | |||
def divide(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.
Здесь и далее лучше использовать более информативные названия переменных. Названия a и b не отражают содержимого. Лучше было бы, например, num1 и num2. Здесь за это баллы еще не снижаем, но с ДЗ 4 нейминг начнет влиять на оценку.
@@ -0,0 +1,25 @@ | |||
def divide(a, b): | |||
return 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.
Не хватает пробелов
def add(a,b): | ||
return 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.
Здесь и в других местах не хватает оформления пробелами. Всё правильно, но на будущее вот так будет выглядеть чуть лучше:
def add(a,b): | |
return a+b | |
def add(a, b): | |
return a + b |
return a+b | ||
|
||
def multiply(x,y): | ||
return(x*y) |
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 скобками не принято. Так делают обычно если вы возвращаете несколько объектов
def subtract(eq1,eq2): | ||
return(eq1-eq2) |
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 subtract(eq1,eq2): | |
return(eq1-eq2) | |
def subtract(num1, num2): | |
return num1 - num2 |
Что значит eq? 😄 Мы же не уравнения вычитаем
def main(): | ||
# eq = [int(i) if i.isdigit() else i for i in input().split()] | ||
eq = input().split() | ||
match eq[1]: |
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.
Огонь что использовали pattern matching!
Его добавили совсем недавно, в 3.10, и это мощная штука.
Мб разберем как-нибудь хотя бы часть из её возможностей.
return multiply(int(eq[0]), int(eq[2])) | ||
case "/": | ||
return divide(int(eq[0]), int(eq[2])) | ||
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.
Такие вещи еще зачастую пишут через
if __name__ == '__main__':
main()
На следующей лекции как раз разберем зачем это нужно
@@ -0,0 +1,11 @@ | |||
Script `calculator.py` performs all basic operations: addition, subtraction, multiplication and division. | |||
|
|||
Credits: |
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.
Круто что вы перечислили обязанности каждого члена команды 👍
@@ -0,0 +1,11 @@ | |||
Script `calculator.py` performs all basic operations: addition, subtraction, multiplication and division. |
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.
Можно было бы сделать чуть более подробное описание вашего функционала. Пример использования какой-нибудь. Мало ли кто-то поставит ваш калькулятор себе но будет подавать выражение без пробелов ("2+2"). Но это уже совсем чтобы красоту навести.
* Matach Dmitri A. - implemented subtraction; | ||
* Bredov Denis V. - implemented `main()` function & team lead. | ||
|
||
 |
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.
Милота
Request merge for branch
HW2_Bredov
. Branch contains directoryHW2_Bredov
withcalculator.py
,README.md
and development crew photo.