[Tutor] raising number to a power

Stefan Behnel stefan_ml at behnel.de
Thu Feb 25 17:02:12 CET 2010


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



More information about the Tutor mailing list