Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hw_zolotikov/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Состав команды**:
Copy link
Member

Choose a reason for hiding this comment

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

Круто что вы перечислили обязанности каждого члена команды 👍

В будущем будет здорово если будете тренироваться делать README на английском

- Золотиков Устин - тимлид, README.md
- Волкова Юлия - mysum()
- Огурцова Анна - main(),mydiv()
- Федоренко Алиса - mysub()
- Козин Иван
![Team](team.jpg)
27 changes: 27 additions & 0 deletions hw_zolotikov/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def mymult(x, y):
Copy link
Member

Choose a reason for hiding this comment

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

Если так называть наверное чуть лучше было бы my_mult. Хотя не знаю.

Copy link
Member

Choose a reason for hiding this comment

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

Здесь и далее лучше использовать более информативные названия переменных. Названия x и y не отражают содержимого. Лучше было бы, например, num1 и num2. Здесь за это баллы еще не снижаем, но с ДЗ 4 нейминг начнет влиять на оценку.

return x * y
def mysub(x, y):
return x - y
def mysum(a, b):
return a+b
Copy link
Member

Choose a reason for hiding this comment

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

Не хватает пробелов

Suggested change
return a+b
return a + b

def mydiv(x,y):
return x/y
def main():
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

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

Между определениями функций принято оставлять 2 пустые строки (ссылка). Тут это не критично, но с ДЗ 4 может влиять на оценку.

Suggested change
return x/y
def main():
return x/y
def main():

inp = input('vvedite to, chto nado poschitat')
Copy link
Member

Choose a reason for hiding this comment

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

  • 'vvedite to, chto nado poschitat' - вот это не очень хорошо))
    По-русски или по-английски. Понимаю что шутка, но все таки не мог не заметить.
  • inp.split(sep =' ') не обязательно было указывать сепаратор, он такой по умолчанию, но ок
  • inp в данном случае более-менее понятное, но все таки не очень супер имя переменной.

inp = inp.split(sep =' ')
x = float(inp[0])
y = float(inp[2])
sign = inp[1]
Comment on lines +10 to +14
Copy link
Member

Choose a reason for hiding this comment

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

В целом код рабочий, хоть и не очень питонячий. Это ничего страшного, мы с вами еще научимся. Например, тут это можно было бы сделать так:

Suggested change
inp = input('vvedite to, chto nado poschitat')
inp = inp.split(sep =' ')
x = float(inp[0])
y = float(inp[2])
sign = inp[1]
num1, operator, num2 = input().split()
num1, num2 = float(num1), float(num2)

Название sign в целом не плохое, но я не уверен что в английском "знак" в смысле математического знака так и переводится. Поэтому я бы сделал operator, хоть так и подлиннее.

result = 0
if sign == "+":
result = mysum(x,y)
elif sign == "-":
result = mysub(x,y)
elif sign == "*":
result = mymult(x,y)
elif sign == "/":
result = mydiv(x,y)
else:
result = "Oshibka"
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

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

Хорошо что сделали else который обрабатывает любой другой неподдерживаемый оператор. Обработать такую ситуацию можно было бы на самом деле чуть аккуратнее, но этому мы еще научимся.

print(result)
Copy link
Member

Choose a reason for hiding this comment

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

Все-таки наверное лучше было бы сделать через return, но наверное это моя неточность в ТЗ.

main()
Copy link
Member

Choose a reason for hiding this comment

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

Такие вещи еще зачастую пишут через

if __name__ == '__main__':
    main()

На следующей лекции как раз разберем зачем это нужно

Binary file added hw_zolotikov/team.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.