+ 3
Learning python
Do I’m inputting the same example written here on my computer but the result is different does anyone knows why? 9**(1/2) R= 1 On the example the result is 3
9 Respuestas
+ 2
Are you using python 2.x on your computer?
+ 5
that worked Anna
thanks Diego Acero
+ 4
yeah i did
+ 4
0
+ 4
2.7
+ 4
For Python 2.x, dividing two integers uses integer division, also known as “floor division”.
That’s why 1/2 = 0. Thus, 9**(1/2) = 9**(0) = 1.
+ 4
Try 9**(1.0/2)
+ 3
That’s weird! Are you sure you wrote the same expression in your computer?
+ 2
Could you please do the division (1/2) in your computer? What is the output?