Skip to content

Commit 06ad80c

Browse files
committed
square,sqrRoot,cube,cubeRoot
Signed-off-by: Brian342 <migelbrian3@gmail.com>
1 parent 4cfc9eb commit 06ad80c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

demp.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
# Write a program that accepts the age of a person,
2-
# if the person is 18 and above, it should print You can vote.
3-
# otherwise it should print You are too young to vote.
1+
# Write a program that accepts a number and then outputs its square, cube, square root and cube root.
2+
import math
3+
number = int(input("Enter a number->"))
4+
square = math.pow(number, 2)
5+
cube = math.pow(number, 3)
6+
sqrt = math.sqrt(number)
7+
cubeRoot = math.cbrt(number)
48

5-
age = int(input("Enter your age->"))
9+
output = (f'the square is->{math.floor(square)}, The cube is->{math.floor(cube)}, The sqrt is->{math.floor(sqrt)}'
10+
f', The cube-root is->{cubeRoot}')
11+
12+
print(output)
613

7-
if age >= 18:
8-
print("You can vote!")
9-
else:
10-
print("You are too young to vote!")
1114

1215

1316

0 commit comments

Comments
 (0)