Calculating square root


#1

if I use n**0.5 the i got square root of n…

but if i do n**(1/2) then i don’t get the correct answer…

pls expalin why is that so?


#2

run this code:

print 1/2

it should give your answer. A division involving two integer will result in a integer (in python2), if the result is a float, python will floor the number (round down)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.