diff --git a/HW2_Stepanova/.gitignore b/HW2_Stepanova/.gitignore new file mode 100644 index 0000000..934a28d --- /dev/null +++ b/HW2_Stepanova/.gitignore @@ -0,0 +1 @@ +.DS_Store/ diff --git a/HW2_Stepanova/README.md b/HW2_Stepanova/README.md new file mode 100644 index 0000000..90fceb1 --- /dev/null +++ b/HW2_Stepanova/README.md @@ -0,0 +1,23 @@ +# About calculator + +A calculator is a program that performs basic arithmetic operations: addition, subtraction, multiplication and division. The calculator takes as input ( ) a string with some mathematical expression and prints a number - the result of calculating this expression. + +# Requirements + +Python 3.x (tested on Python 3.8 and above). + +# Team + +Shchekuteva Ekaterina, Revyakina Lilia, Loginova Olga, Stepanova Arina. + +# Citation + +;) If you use calculator in your work, please cite [https://github.com/arrstepa/HW2_Stepanova]. + +# Feedback and bug reports + +If you have any troubles running calculator, please attach params.txt and calculator.log :) + +# Screenshot of the team meeting + +![](imgs/screenshot.jpg) diff --git a/HW2_Stepanova/calculator.py b/HW2_Stepanova/calculator.py new file mode 100644 index 0000000..39340d3 --- /dev/null +++ b/HW2_Stepanova/calculator.py @@ -0,0 +1,32 @@ +def multiple(a,b): + "Функция умножения двух чисел" + return a*b + +def substraction(a, b): + "Функция вычитания b из a" + return a - b + +def addition (a, b): + "Функция сложения двух чисел" + return a + b + +def division (a, b): + "Функция деления a на b" + if b!= 0: + return a/b + else: + return "деление на 0!" + +def main(): + exp=input("Введите выражение: ").split() + a,operation,b = float(exp[0]), exp[1], float(exp[2]) + if operation == "+": + print(addition(a,b)) + elif operation == "-": + print(substraction(a,b)) + elif operation == "*": + print(multiple(a,b)) + else: + print(division(a,b)) + +main() diff --git a/HW2_Stepanova/imgs/screenshot.jpg b/HW2_Stepanova/imgs/screenshot.jpg new file mode 100644 index 0000000..d363863 Binary files /dev/null and b/HW2_Stepanova/imgs/screenshot.jpg differ