diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..34aefd6 Binary files /dev/null and b/.DS_Store differ diff --git a/HW2_Trofimov/README.md b/HW2_Trofimov/README.md new file mode 100644 index 0000000..6eb26bb --- /dev/null +++ b/HW2_Trofimov/README.md @@ -0,0 +1,12 @@ +# Calculator +Yep. Calculator. + +This magnificent piece of software engineering is done by these killas: + +![screenshot](https://github.com/michtrofimov/HW2_Git_and_python/assets/92677906/862d524c-c68b-4229-b67b-f92ea140af84) + +- Ilia Popov ('multiplication' function) +- Julia Nechaeva ('addition' function) +- Ekaterina Shitik ('subtraction' function) +- Ricardo Milos / Pavel Grobushkin ('division' function) +- Michil Trofimov ('main' function) diff --git a/HW2_Trofimov/Screenshot 2023-09-13 at 20.28.41.png b/HW2_Trofimov/Screenshot 2023-09-13 at 20.28.41.png new file mode 100644 index 0000000..27cf27b Binary files /dev/null and b/HW2_Trofimov/Screenshot 2023-09-13 at 20.28.41.png differ diff --git a/HW2_Trofimov/calculator.py b/HW2_Trofimov/calculator.py new file mode 100644 index 0000000..f6a2fa4 --- /dev/null +++ b/HW2_Trofimov/calculator.py @@ -0,0 +1,42 @@ +def main(): + calc_input = input() + calc_input_lst = calc_input.split() + + operation = calc_input_lst[1] + number_1 = calc_input_lst[0] + number_1 = float(number_1) + number_2 = calc_input_lst[2] + number_2 = float(number_2) + + if operation == "+": + res = addition(number_1, number_2) + elif operation == "-": + res = subtraction(number_1, number_2) + elif operation == "*": + res = multiplication(number_1, number_2) + elif operation == "/": + res = division(number_1, number_2) + return print(res) + + +def multiplication(number_1, number_2): + res = number_1 * number_2 + return res + + +def subtraction(number_1, number_2): + res = number_1 - number_2 + return res + + +def addition(number_1, number_2): + res = number_1 + number_2 + return res + + +def division(n1, n2): + res = n1 / n2 + return res + + +main() diff --git a/HW2_Trofimov/screenshot.jpg b/HW2_Trofimov/screenshot.jpg new file mode 100644 index 0000000..e7865a2 Binary files /dev/null and b/HW2_Trofimov/screenshot.jpg differ