Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36498

Re: new to python and programming at large

References <0CF6C67958A245C883EB705CEF9F968F@favour> <mailman.319.1357744700.2939.python-list@python.org> <M9gHs.6$6N2.4@fx17.fr7>
Date 2013-01-10 02:43 +1100
Subject Re: new to python and programming at large
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.320.1357746205.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jan 10, 2013 at 2:38 AM, Alister <alister.ware@ntlworld.com> wrote:
> On Thu, 10 Jan 2013 02:18:11 +1100, Chris Angelico wrote:
>
>> On Thu, Jan 10, 2013 at 8:03 AM,  <kwakukwatiah@gmail.com> wrote:
>>> pls  I want to write a function that can compute for the sqrt root of
>>> any number.bt 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
>
> why even do this when simply calling sqrt is all that is needed?

Good question. But without a lot more context from the OP, none of
this is really ponderable...

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: new to python and programming at large Chris Angelico <rosuav@gmail.com> - 2013-01-10 02:18 +1100
  Re: new to python and programming at large Alister <alister.ware@ntlworld.com> - 2013-01-09 15:38 +0000
    Re: new to python and programming at large Chris Angelico <rosuav@gmail.com> - 2013-01-10 02:43 +1100

csiph-web