[Tutor] How do I do cubic roots and cubic exponents (and higher roots and exponents) in Python?

Gregor Lingl glingl at aon.at
Tue May 9 09:53:34 CEST 2006


Danny Yoo schrieb:

>  
>
>>How do I do cubic (and higher) roots ...
>>
>
>I think you're looking for the '**' operator.  Like addition and 
>multiplication, it can take in two numbers.
>
>##########
>  
>
>>>>2 ** 2
>>>>        
>>>>
>4
>  
>
And they also can be floating point numbers

 >>> 2 ** 0.5
1.4142135623730951
 >>> 2 **(1.0/3)
1.2599210498948732
 >>> 1.2599210498948732**3
2.0

:-)

gregor


More information about the Tutor mailing list