Skip to content
Closed
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 added __pycache__/calculator.cpython-313-pytest-9.0.2.pyc
Binary file not shown.
Binary file added __pycache__/calculator.cpython-313.pyc
Binary file not shown.
Binary file not shown.
54 changes: 38 additions & 16 deletions calculator.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
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)
print(x)

def multiply(a, b):
"""Multiply two numbers."""
return a * b

def add(a, b):
"""Add two numbers."""
return a + b

def subtract(a, b):
"""Subtract b from a."""
return a - b

def divide(a, b):
"""Divide a by b."""
return a / b

def square(a):
"""Square a number."""
return a ** 2

def cube(a):
"""Cube a number."""
return a ** 3

def square_n_times(number, n):
"""Square the number n times and return the sum of all intermediate values."""
result = number
total = number
for i in range(n):
result = result ** 2
total += result
return total

print("I'm going use the calculator functions to multiply 5 and 6")
x = multiply(5,6)
print(x)