Skip to content

Commit 50c9237

Browse files
Add files via upload
1 parent 8fe6f4a commit 50c9237

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: Fun with Numbers/Power, cube and square.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SQUARE
2+
def squarenum():
3+
x = float(input("Enter a number: "))
4+
print("The square is ",square(x))
5+
6+
def square(n):
7+
return n * n
8+
9+
# CUBE
10+
def cubenum():
11+
x = float(input("Enter a number: "))
12+
print("The cube is ",cube(x))
13+
14+
def cube(n):
15+
return n * n * n
16+
17+
#Power
18+
def powernum():
19+
x = float(input("Enter a number: "))
20+
y = float(input("Enter a exponent: "))
21+
print("The power is ",power(x,y))
22+
23+
def power(x,y):
24+
return pow(x,y)
25+
26+
# Now using are own function
27+
squarenum()
28+
cubenum()
29+
powernum()

0 commit comments

Comments
 (0)