[Tutor] Cube root
akleider at sonic.net
akleider at sonic.net
Sun Sep 16 03:37:09 CEST 2012
> On Sat, Sep 15, 2012 at 5:36 PM, Dave Angel <d at davea.name> wrote:
>> On 09/15/2012 05:28 PM, Amanda Colley wrote:
>>> Ok, I have to get input from a user ('enter a number') and then get
>>> the
>>> cube root of that number. I am having trouble with the code to get the
>>> cube root. If anyone can help me solve this I would greatly appreciate
>>> it.
>>> ('enter a number')
>>> n=number
>>> ??? cube root??
>>>
>>>
>>
>> The operator to raise a number to a particular power is **, and it's not
>> constrained to integer powers. So 5*2 is 25. See what's next?
>>
> This is a great place to ask questions. But don't forget google (or bing)
>
> try googling python cube root
>
> see how you do and come back with your code!
> --
> Joel Goldstick
Why does:
"""
>>> import math
>>> 9**(1/3.0)
2.080083823051904
>>> 9.0**(1.0/3.0)
2.080083823051904
>>>
"""
not seem to work?
>
More information about the Tutor
mailing list