Calling Values

subhabangalore at gmail.com subhabangalore at gmail.com
Fri Aug 3 10:38:45 EDT 2012


On Friday, August 3, 2012 5:19:46 PM UTC+5:30, Subhabrata wrote:
> Dear Group,
> 
> 
> 
> 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
> 
> 	print "New Number One is:",num3
> 
> 	print "New Number Two is:",num4
> 
> 	return
> 
> 
> 
> I am preferring not to use argument passing or using class? Is there any alternate way?
> 
> 
> 
> Thanking in Advance,
> 
> Regards,
> 
> Subhabrata.

Dear Group,

def func1():

 	num1=10

 	num2=20

 	print "The Second Number is:",num2

 	return


def func2():

        func1()
	num3=num1+num2

 	num4=num3+num1

	print "New Number One is:",num3

	print "New Number Two is:",num4


This works. Even you can incoportate some conditionals over func1() in func2() and run.
My question can I call its values of func1() too? 
What it is the big deal in experimenting we may come up with some new code or a new need?
Indentation slightly differs while you post, I agree. Return I just like too use.
Mark you are too concerned for me, thanks.

Regards,
Subhabrata.

 



More information about the Python-list mailing list