Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

John Smith
seal-mask
.a{fill-rule:evenodd;}techdegree
John Smith
Python Web Development Techdegree Student 1,052 Points

Does anyone know what this code is missing?

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

def unpacker(fist_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"})

Hello Ruddy,

Can you format your code properly so that the community can read it easily? Reference the Markdown Cheatsheet below the answer box :arrow_heading_down:

hi, I see a misspelled word : "unpacker(fist_name " should be first_name".

2 Answers

  • Indentation is not consistent.
  • You called the first argument to unpacker fist_name, but later on you refer to "first_name".
  • I'm assuming this is not code for a [Treehouse] code challenge, but if it is, you may want to read the challenge instructions again. This is probably not what the challenge wants.
John Smith
seal-mask
.a{fill-rule:evenodd;}techdegree
John Smith
Python Web Development Techdegree Student 1,052 Points

Thank you very much Alexander. This code is from the workspace's exercise. I looked at this code multiple time and I still was not able to catch that misspelling from "first_name". Thanks a lot, I will have to pay more attention to these kinds of errors.

No problem :)

John Smith
seal-mask
.a{fill-rule:evenodd;}techdegree
John Smith
Python Web Development Techdegree Student 1,052 Points
          <p>

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


def unpacker(fist_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"})

</p>
          ```