diff --git a/__pycache__/calculator.cpython-314.pyc b/__pycache__/calculator.cpython-314.pyc new file mode 100644 index 0000000..f34d566 Binary files /dev/null and b/__pycache__/calculator.cpython-314.pyc differ diff --git a/__pycache__/test_calculator.cpython-314-pytest-9.0.2.pyc b/__pycache__/test_calculator.cpython-314-pytest-9.0.2.pyc new file mode 100644 index 0000000..39ca299 Binary files /dev/null and b/__pycache__/test_calculator.cpython-314-pytest-9.0.2.pyc differ diff --git a/calculator.py b/calculator.py index 24a2fef..e0c117d 100644 --- a/calculator.py +++ b/calculator.py @@ -1,16 +1,30 @@ -def multiply(a,b): - return a * b - -def add(a,b): - return a+b - -def subtract(a,b): - return a-b - -def divide(a,b): - return a/b - - -print("I'm going use the calculator functions to multiply 5 and 6") -x = multiply(5,6) +def add(a, b): + return a + b + +def subtract(a, b): + return a - b + +def multiply(a, b): + return a * b + +def divide(a, b): + if b == 0: + raise ZeroDivisionError("Cannot divide by zero.") + return a / b + +def square(a): + return a * a + +def cube(a): + return a * a * a + +def square_n_times(a, n): + return square(a) * n + +print("I'm going use the calculator functions to divide 5 by 6") +x = divide(5,6) +print(x) + +print("I'm going use the calculator functions to square 5 three times and sum the results") +x = square_n_times(5,3) print(x) \ No newline at end of file