diff --git a/HW2_Gorbarenko/README.md b/HW2_Gorbarenko/README.md new file mode 100644 index 0000000..75e3047 --- /dev/null +++ b/HW2_Gorbarenko/README.md @@ -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* + +### Описание скрипта + +calculator.py - скрипт, позволяющий выполнять сложение, вычитание, умножение и деление двух чисел. + +Ввод осуществляется в виде строки + +`a _ b` + +где `a` и `b` - числа, + +`_` - один из четырёх символов: `+ - * /`, соответствующих арифметическим операциям сложения, вычитания, умножения и деления. + +Все три элемента должны быть разделены пробелами. + +Пожалуйста, не делите на ноль! :fearful: + +#### Наша прекрасная команда + +Алиса Кабалина + +Дарья Соколова + +Кирилл Петриков + +Татьяна Лисица + +Анастасия Горбаренко, team leader + +![alt_text](https://github.com/KirPetrikov/HW2_Git_and_python/blob/HW2_Petrikov/HW2_Gorbarenko/photo.jpg?raw=true) diff --git a/HW2_Gorbarenko/calculator.py b/HW2_Gorbarenko/calculator.py new file mode 100644 index 0000000..8f2370c --- /dev/null +++ b/HW2_Gorbarenko/calculator.py @@ -0,0 +1,39 @@ + +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) + +def teilen(a,b): + return(a / b) + +def delta(a, b): + return a - b + +def sokol_sum(a,b): + return a+b + +def multi(a, b): + return(a * b) + + +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") + + + + diff --git a/HW2_Gorbarenko/photo.jpg b/HW2_Gorbarenko/photo.jpg new file mode 100644 index 0000000..a3a5ac1 Binary files /dev/null and b/HW2_Gorbarenko/photo.jpg differ