Python

IAN WOOD
IAN WOOD
1,336 Points

Packing and Unpacking Dictionaries video: workspace code not working...?

I know enough to know I'm probably missing SOMETHING, but as far as I can tell this is identical to the code Ken is using in the video:

def packer(name=None, **kwargs):
    print(kwargs)


def unpacker(first_name=None, last_name=None):
    if first_name and last_name:
        print("Hi {} {}!".format(first_name, last_name))
    else:
        print("Hi no name!")

packer(name="Kenneth", num=42, spanish_inquisition=None)
unpacker(**{"last_name": "Love", "first_name": "Kenneth"})

...but it doesn't run. No error, just:

treehouse:~/workspace$ python luggage.py treehouse:~/workspace$

(Yes the file is saved)

Chris Howell
Chris Howell
Treehouse Moderator

Fixed: code snippet to use Markdown.

2 Answers

IAN WOOD
IAN WOOD
1,336 Points

Got it working - must've been a cache thing; when I reloaded the saved luggage.py to get the snapshot, it still had indents on lines 12 & 13 that weren't showing up in the window, even though the file didn't have the unsaved changes dot.

Chris Howell
Chris Howell
Treehouse Moderator

Sweet, glad to see you got it working!

Chris Howell
MOD
Chris Howell
Treehouse Moderator

Hi IAN WOOD

I copied your code into my own workspace and it works just fine. Could you possibly take a Snapshot of your workspace then share the link with me so I can have a look at your copy?