[Tutor] raising number to a power
Ricardo Aráoz
ricaraoz at gmail.com
Thu Feb 25 19:35:05 CET 2010
Stefan Behnel wrote:
> Monte Milanuk, 25.02.2010 16:47:
>
>> Is there a benefit (besides brevity) one way or the other between using:
>>
>> import math
>> ...
>> math.pow(x,y) # x raised to the power y
>>
>> vs.
>>
>> x**y
>>
>> ?
>>
>
> Did you try it?
>
> >>> import math
> >>> print(math.pow(4,4))
> 256.0
> >>> 4**4
> 256
> >>> 4.0**4
> 256.0
>
> Stefan
>
Yes, I tried it.
Now, is there a benefit (besides brevity) one way or the other?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100225/d254efd8/attachment-0001.html>
More information about the Tutor
mailing list