Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/calculator.cpython-312.pyc
Binary file not shown.
24 changes: 22 additions & 2 deletions calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,27 @@ def subtract(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)
print(x)
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