Import math print(math.pow(27,1/3)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Import math print(math.pow(27,1/3))

How to solve it??

14th Jul 2020, 11:28 AM
Ansari Afzal
Ansari Afzal - avatar
6 Answers
+ 2
Division results in floating points. print(3**3) // 27 print(3**(9/3)) // 27.0
14th Jul 2020, 12:27 PM
Avinesh
Avinesh - avatar
+ 1
27 is equal to (3)3**1/3 So answer is 3.0 Here , ** is used for exponential power. It is simple maths.
14th Jul 2020, 11:33 AM
Sâñtôsh
Sâñtôsh - avatar
+ 1
Ansari Afzal that was just an example and I did not try to bring the same output. The point I was trying to make is that since the code has 1/3 which is division operation, returns a floating point value so any mathematical operation performed with it will result in a floating point value.
14th Jul 2020, 4:30 PM
Avinesh
Avinesh - avatar
0
How the result comes in Floating??
14th Jul 2020, 11:41 AM
Ansari Afzal
Ansari Afzal - avatar
0
Avinesh thnx brother
14th Jul 2020, 4:40 PM
Ansari Afzal
Ansari Afzal - avatar
- 1
No bro answer is 3.0
14th Jul 2020, 4:19 PM
Ansari Afzal
Ansari Afzal - avatar