Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: new to python and programming at large. Date: Wed, 9 Jan 2013 17:43:54 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 25 Message-ID: References: NNTP-Posting-Host: panix2.panix.com X-Trace: reader1.panix.com 1357753434 13069 166.84.1.2 (9 Jan 2013 17:43:54 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 9 Jan 2013 17:43:54 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:36512 In kwakukwatiah@gmail.com writes: > thanks for ur help I wz able to do it.but I wish to expand it by asking > a user to input a number for the sqrt to be calculated it I dd it this > way but its not working. > from math import sqrt > number = raw_input('enter a number:') > def number(y): > return number(Y) You're storing the user input in a variable called 'number', but then you define a method also called 'number'. Call them something different. Within your method, you probably want to return sqrt(y) instead of calling the method from itself. The argument to your method is called 'y' in the definition, but you refer to it as 'Y' in the return statement. Variable names are case-sensitive. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"