0
Divisions create float in python 3 then... Why float is used in >>>9**(1/2) that is 3.0 and >>>2**5 is 32
In exponential operation >>>2**5 is 32 float not used but in >>>9**(1/2) is 3.0 float is used
2 Antworten
+ 2
Didn't the answer jump at you as you typed this question? :)
Square root of 9 is 9**0.5. And once there is a float in an expression, it propagates all the way to the expression's final value. Thus 3.0.
+ 2
Implicit variable typing:
An integer elevated to the power of another integet is necessarly an integer, while an integer elevated to a power of 1/n will calculate the nth root of it, and will implicitly return a float type... as any float in a power expression ^^