[Tutor] mysterious object

Christopher Spears cspears2002 at yahoo.com
Sun Dec 18 00:42:27 CET 2005


I'm working on Exercise 4 from Part 4 from Learning
Python.  I'm trying to write a function using **args. 
I want to create a function that adds its arguments
together.  Here is what I have written:

def adder(**args):
    for x in args.keys():
        print x

print adder()
print "---"
print adder(a=5)
print "---"
print adder(a=5,b=6)
print "---"
print adder(a=5,b=6,c=7)
print "---"
print adder(ugly=7, good=6, bad=5)
print "---"


Here is my output:

None
---
a
None
---
a
b
None
---
a
c
b
None
---
ugly
bad
good
None
---

Where do the None objects come from?


More information about the Tutor mailing list