new to python and programming at large

Chris Angelico rosuav at
Wed Jan 9 16:18:11 CET 2013

On Thu, Jan 10, 2013 at 8:03 AM,  <kwakukwatiah at> wrote:
> pls  I want to write a function that can compute for the sqrt root of any
> it not working pls help.
> from math import sqrt
> def squareroot(self):
>     x = sqrt(y)
>     print x

The 'self' argument is a convention used in classes. You probably want
to call your argument y:

def squareroot(y):

since that's what you then pass to math.sqrt.

Chris Angelico

More information about the Python-list mailing list