We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2e222f9 + b78125b commit 90ded27Copy full SHA for 90ded27
1 file changed
calculator.py
@@ -1,15 +1,31 @@
1
-def multiply(a,b):
2
- return a * b
3
-
4
def add(a,b):
5
return a+b
6
7
def subtract(a,b):
8
return a-b
9
+def multiply(a,b):
+ return a * b
+
10
def divide(a,b):
11
return a/b
12
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
+ if n < 0:
21
+ raise ValueError("n must be non-negative number")
22
+ total = 0
23
+ value = number
24
+ for _ in range(n):
25
+ value = value * value
26
+ total += value
27
+ return total
28
29
print("I'm going use the calculator functions to multiply 5 and 6")
30
x = multiply(5,6)
31
print(x)
0 commit comments