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 added __pycache__/calculator.cpython-314.pyc
Binary file not shown.
Binary file not shown.
44 changes: 29 additions & 15 deletions calculator.py
Original file line number Diff line number Diff line change
@@ -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)