Skip to content

Commit 2df80c6

Browse files
Eman MuamarEman Muamar
authored andcommitted
add square, cube, and square_n_times functions
1 parent 4e927c5 commit 2df80c6

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

calculator.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ def divide(a, b):
1515

1616
print("I'm going use the calculator functions to multiply 5 and 6")
1717
x = multiply(5,6)
18-
print(x)
18+
print(x)
19+
20+
def square(x):
21+
return x ** 2
22+
23+
24+
def cube(x):
25+
return x ** 3
26+
27+
28+
def square_n_times(number, n):
29+
total = 0
30+
for _ in range(n):
31+
total += number ** 2
32+
return total
33+

0 commit comments

Comments
 (0)