0

In the example 2 ** 5=32 and 9 ** (1/2)=3.0

Why in the first example python returns only integer(32) and in the 2nd example returns float (3.0)??

5th Apr 2019, 7:34 AM
Honey
1 Antwort
+ 7
Because 1/2 is basically converted to 0.5 which is a float. Hence, the answer is second case is a float as a float is involved while in first case, only integers are involved. Thus, answer is in integer only.
5th Apr 2019, 8:00 AM
Arushi Singhania
Arushi Singhania - avatar