Skip to content
Merged
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
22 changes: 19 additions & 3 deletions calculator.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
def multiply(a,b):
return a * b

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):
return a/b

def square(a):
return a*a

def cube(a):
return a*a*a

def square_n_times(number, n):
if n < 0:
raise ValueError("n must be non-negative number")
total = 0
value = number
for _ in range(n):
value = value * value
total += value
return total

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