Am 03.08.2012 13:49, schrieb Subhabrata:
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?

You could make those variables global, see the "global" statement in the documentation of the language. However: I don't think that is a good idea and it will make your program more confusing to read than necessary, but go ahead and make that experience yourself. ;)

If you want, you can post your code here when done so that others might give you hints how to do things easier and cleaner, like e.g. putting spaces around operators and using four spaces indention (See PEP 8) or dropping the implied return from functions that return nothing. Apart from that, the above code is too short and with too little info what it's supposed to achieve, I can't really give you better advise.

Good luck!

Uli
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to