From 593109cf1b245240bef64b0aa3a6621188ef42e2 Mon Sep 17 00:00:00 2001 From: mandy7am Date: Sun, 18 Jan 2026 14:35:31 -0500 Subject: [PATCH 1/2] add function to calculator --- __pycache__/calculator.cpython-312.pyc | Bin 606 -> 606 bytes calculator.py | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/__pycache__/calculator.cpython-312.pyc b/__pycache__/calculator.cpython-312.pyc index 09c608d21c24cac45c2070dcb5378756a7fc0400..08d3c5fd1e2e79dbeaf2e7299a91b3cc0464bd96 100644 GIT binary patch delta 62 zcmcb|a*u`gG%qg~0}w>&KgIW;43 Date: Sun, 18 Jan 2026 14:54:53 -0500 Subject: [PATCH 2/2] Add square, cube, and square_n_times functions --- calculator.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/calculator.py b/calculator.py index d4e1195..05ef9d3 100644 --- a/calculator.py +++ b/calculator.py @@ -13,3 +13,24 @@ def divide(a,b): print("I'm going use the calculator functions to multiply 5 and 6") x = multiply(5,6) print(x) + +def square(x): + """Return x squared.""" + return x ** 2 + + +def cube(x): + """Return x cubed.""" + return x ** 3 + +def square_n_times(number, n): + """Square the number n times and return the sum.""" + total = 0 + current = number + + for _ in range(n): + current = current ** 2 + total += current + + return total +