Could any one explain clearly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Could any one explain clearly

Print(9**(1/2)) answer is 3.0 how?

16th Jun 2020, 8:38 AM
Sufia Hashmi
Sufia Hashmi - avatar
5 Answers
+ 5
In python if you operate mathematical operation with a float type, your output will also be a float. So, 9**(1/2) → 9 ** 0.5 (parenthesis first) → 3.0 (not 3 bcz the power is a float)
16th Jun 2020, 8:56 AM
M Tamim
M Tamim - avatar
+ 5
It's Me It's Mathematics at work :) x**(y/z) equals (x**y)**1/z And **1/z is actually the z-root of the number. So: 9**(1/2) == ²√9¹ = ²√9 = 3.0 8**(2/3) == ³√8² = ³√64 = 4.0 and so on.
16th Jun 2020, 9:56 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
[Edited]: 9**(1/2) => 9**(0.5) => 3.0 Taking a number to the power of 0.5 is the same as if you calculate the square root of that number. You can try it in the console or in a short script.
16th Jun 2020, 8:46 AM
Lothar
Lothar - avatar
+ 4
It's Me u can write 0.5 like this 1/2 . 1/2==0.5 and root √ value is equal to 1/2 then we can write 9 as 3 to the power 2 means (3^2) and 9**(1/2) =3^2*1/2 =3.0
17th Jun 2020, 7:51 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
9**0.5 = 3.0 how?
16th Jun 2020, 8:59 AM
Sufia Hashmi
Sufia Hashmi - avatar