0

Why does this return 1.0 as output.

print(9.0**(1.0//2.0)).. Output should be 9.0 right??

22nd Sep 2016, 4:01 AM
Raj Sundhar
3 odpowiedzi
+ 1
1.0//2.0 returns a 0, and 9.0**0 is equal to 1.0
22nd Sep 2016, 1:46 PM
Fernando Carvalho
Fernando Carvalho - avatar
0
simple bro... single / is produce quotient and double // is produce remainder. so 1.0/2.0=2.0 then 9.0**2.0=3.0 then 1.0//2.0=0.0 then 9.0**0.0=1.0
22nd Sep 2016, 7:08 AM
Ramanathan Raveendran
Ramanathan Raveendran - avatar
- 1
9 to power 0 is 1 (9 to power 1 is 9)
22nd Sep 2016, 5:00 PM
Rohit Kumar