Skip to content

HW2_Gorbarenko #5

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

CaptnClementine
Copy link

No description provided.

Copy link

@SidorinAnton SidorinAnton left a comment

Choose a reason for hiding this comment

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

В целом неплохо! Сообщения коммитов хорошие, в ридми даже смайлик добавили :)
Проблема с названиями переменных и функций, а также со стилем (не по PEP8). Сейчас пока ладно, но дальше будет критично :)
Ну и нужно было сделать функцию main ))

Comment on lines +2 to +11
a,b,c = input().split()
if ("." in a) or ("." in c):
a = float(a)
c = float(c)
elif ("," in a) or ("," in c):
a = float(a.replace(',','.'))
c = float(c.replace(',','.'))
else:
a = int(a)
c = int(c)
Copy link

@SidorinAnton SidorinAnton Sep 18, 2023

Choose a reason for hiding this comment

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

Это и после функций нужно было завернуть в функцию main. По заданию:

Функция main внутри себя должна принимать входное выражение, отдавать его на вычисление соответствующей функции, получать результат и печатать его на экран. Каждая из 4 функций лишь принимает определенное выражение от главной функции, вычисляет его и возвращает результат главной функции.

@@ -0,0 +1,39 @@

a,b,c = input().split()

Choose a reason for hiding this comment

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

Здесь и везде ниже. Названия переменных a, b, c абсолютно не информативны.

num1, operator, num2 = input().split()

@@ -0,0 +1,39 @@

a,b,c = input().split()
if ("." in a) or ("." in c):

Choose a reason for hiding this comment

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

Обрабатывать сразу 2 числа тут плохо. Попробуйте протестировать на вот таком инпуте:
1,2 + 1.2

Comment on lines +26 to +35
if (b == "+"): #sokol_sum
print(sokol_sum(a,c))
elif (b == "-"): #delta
print(delta(a,c))
elif (b == "*"): #multi
print(multi(a,c))
elif (b == "/") : #teilen
print(teilen(a,c))
else:
print("I dont know what it is")
Copy link

@SidorinAnton SidorinAnton Sep 18, 2023

Choose a reason for hiding this comment

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

И вот это должно было быть в main.

Функция main внутри себя должна принимать входное выражение, отдавать его на вычисление соответствующей функции, получать результат и печатать его на экран. Каждая из 4 функций лишь принимает определенное выражение от главной функции, вычисляет его и возвращает результат главной функции.

Ну и плюс в ифах тут не нужны скобки. Вообще я бы сделал вот так:

# С учетом правок по названиям
result = "I dont know what it is"

if operator == "+":
    result = addition(num1, num2)
elif operator == "-":
    result = substraction(num1, num2)
elif operator == "*":
    result = multiplication(num1, num2)
elif operator == "/":
    result = division(num1, num2)

print(result)

Comment on lines +13 to +14
def teilen(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.

  1. teilen? Почему не division? ))
  2. В return тут не нужны скобки.

def teilen(a,b):
return(a / b)

def delta(a, b):

Choose a reason for hiding this comment

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

delta? Почему не substraction? ))

def delta(a, b):
return a - b

def sokol_sum(a,b):

Choose a reason for hiding this comment

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

sokol тут лишний )))
Можно назвать, например, addition

def sokol_sum(a,b):
return a+b

def multi(a, b):

Choose a reason for hiding this comment

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

В целом норм, но лучше тогда уж multiplication ))

@@ -0,0 +1,32 @@
# HW2_Git_and_python from Gorbarenko team
*This is the repo for the second homework of the BI Python 2023 course*

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.

6 participants