Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36497
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Subject | Re: new to python and programming at large |
| Newsgroups | comp.lang.python |
| References | <0CF6C67958A245C883EB705CEF9F968F@favour> <mailman.319.1357744700.2939.python-list@python.org> |
| Message-ID | <M9gHs.6$6N2.4@fx17.fr7> (permalink) |
| Organization | virginmedia.com |
| Date | 2013-01-09 15:38 +0000 |
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? -- Outside of a dog, a book is man's best friend. Inside of a dog, it is too dark to read.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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