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 +