Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Smith
Python Web Development Techdegree Student 1,052 PointsDoes 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"})
Tanja Riet
10,803 Pointshi, I see a misspelled word : "unpacker(fist_name " should be first_name".
2 Answers
Alexander Davison
65,469 Points- 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
Python Web Development Techdegree Student 1,052 PointsThank 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.
Alexander Davison
65,469 PointsNo problem :)
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>
```
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsHello Ruddy,
Can you format your code properly so that the community can read it easily? Reference the Markdown Cheatsheet below the answer box