Welcome to the Treehouse Community
Looking to learn something new?
Why when I try to pass a value to *arg it doesn't get passed to it.
I'm trying to catch second_color outside of the packing, and pass "I'm a tuple" to *args and print out both args and kwargs. Here's my example:
def color(second_color = None, *args, **kwargs):
color(second_color= "Brown", "I'm a tuple", first_color= "Red", last_color= "Blue")
SyntaxError: positional argument follows keyword argument
Kent Åsvang18,823 Points
You need to remove the "second_color"-keyword from your function-call.
color("Brown", "I'm a tuple", first_color= "Red", last_color= "Blue")
You can read about why here if you are interested
Also, remember that kwargs are dictionaries. So if you want to print them out you should use dict().items() and a for-loop:
for item in kwargs.items(): print(item)
for the args you can just use a basic for-loop:
for item in args: print(items)
I hope this helped