Numeric Operations | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Numeric Operations

Can somebody please Explain How that works? >>> 9 ** (1/2) 3.0

9th Feb 2020, 2:00 PM
Muhammad Abdullah
Muhammad Abdullah - avatar
1 Answer
+ 2
The ** is the power operator. So 3**2 is 3 squared (3x3) which is 9. 9 ** (1/2) is then the square root of 9, which is 3. Notice that, like division in python, it returns a float, not an int.
9th Feb 2020, 2:03 PM
Russ
Russ - avatar