new to python. couldn't figure out the answer to this question for 2 days now.. would appreciate some help, googling didn't help.
Fill in the "foo" and "bar" functions so they can receive a variable amount of arguments (3 or more) The "foo" function must return the amount of extra arguments received. The "bar" must return "True" if the argument with the keyword "magicnumber" is worth 7, and False otherwise.
# edit the functions prototype and implementation
def foo(a, b, c):
pass
def bar(a, b, c):
pass
# test code
if foo(1,2,3,4) == 1:
print "Good."
if foo(1,2,3,4,5) == 2:
print "Better."
if bar(1,2,3,magicnumber = 6) == False:
print "Great."
if bar(1,2,3,magicnumber = 7) == True:
print "Awesome!"
I guess.. some partial code will be good, having trouble understanding **kwargs and all that :\