Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader01.nrc01.news.zen.net.uk.POSTED!not-for-mail From: Nobody Subject: Re: Calling Values Date: Fri, 03 Aug 2012 13:44:31 +0100 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.python References: <8bdc29d5-fa88-4ead-a4a1-135d708eeb57@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lines: 21 Organization: Zen Internet NNTP-Posting-Host: 190ebcb2.news.zen.co.uk X-Trace: DXC=I@\[6CUf2S_]a0UP_O8AJo\=dR0\ckLKGPWeZ<[7LZNRVAGI^?C\XSX[M2Z^cWRFGA[PMg4J>lPSlU X-Complaints-To: abuse@zen.co.uk Xref: csiph.com comp.lang.python:26430 On Fri, 03 Aug 2012 04:49:46 -0700, Subhabrata wrote: > I am trying to call the values of one function in the another function > in the following way: > def func1(): > num1=10 > num2=20 > print "The Second Number is:",num2 > return > > def func2(): > num3=num1+num2 > num4=num3+num1 A function's local variables only exist while that function is being executed[1]. It's meaningless to try to access them from outside the function. [1] There is an exception (closures), but it doesn't have any bearing on this particular problem.