File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 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 )
4
8
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 )
6
13
7
- if age >= 18 :
8
- print ("You can vote!" )
9
- else :
10
- print ("You are too young to vote!" )
11
14
12
15
13
16
You can’t perform that action at this time.
0 commit comments