[Tutor] mysterious object
Alan Gauld
alan.gauld at freenet.co.uk
Sun Dec 18 01:45:46 CET 2005
> def adder(**args):
> for x in args.keys():
> print x
A function which doesn't return a value returns None by default.
> print adder()
You are asking Python to print the return value of the function,
which is None.
As a general rule its better to do the printing outside of the function and
just do the calculation bit inside, this makes the function much easier to
reuse in future.
HTH
Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list