Skip to content

Commit 14f491f

Browse files
committed
added square and cube finallyy
1 parent 9e0c41c commit 14f491f

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

calculator.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@ def multiply(a, b):
1010
def divide(a, b):
1111
return a / b
1212

13+
def square(a):
14+
return a * a
15+
16+
def cube(a):
17+
return a * a * a
18+
19+
def square_n_times(number, n):
20+
updated_number = 0
21+
changed_number = number
22+
for times in range(n):
23+
changed_number = changed_number * changed_number
24+
updated_number = updated_number + changed_number
25+
return updated_number
26+
1327
print("I'm going use the calculator functions to divide 30 by 6")
1428
x = divide(30,6)
1529
print(x)
30+
31+
# print("I'm going use the calculator functions to raise 30 by the power of 2")
32+
# x = square(30)
33+
# print(x)
34+
35+
# print("I'm going use the calculator functions to determine 30 cubed")
36+
# x = cube(30)
37+
# print(x)
38+
39+
# print("I'm going use the calculator functions to determine 3 cubed")
40+
# x = square_n_times(3, 3)
41+
# print(x)

0 commit comments

Comments
 (0)