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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Ceil-Ian Maralit](https://uploads.teamtreehouse.com/production/profile-photos/10173842/micro_28459F92-CD3A-407B-BF11-B95FB66D7C74.jpg)
Ceil-Ian Maralit
Front End Web Development Techdegree Graduate 19,434 PointsWhy pass it as a dictionary when we can just pass it as key/value pairs?
Hi! I don't understand why it is passed as a dictionary when we can just pass it as key/value pairs and still work the same. Is it just for the sake of clarity?
Here is the their example:
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!")
unpacker(**{"first_name": "Ceil", "last_name": "Cisneros"})
Here is my test:
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!")
unpacker(first_name = "Ceil", last_name = "Cisneros")
Thanks in advance!
--Ceil
1 Answer
![Jeff Muday](https://uploads.teamtreehouse.com/production/profile-photos/5900142/micro_jeff_face.jpg)
Jeff Muday
Treehouse Moderator 28,718 PointsThis challenge is setting you up to have a better understanding of argument passing. In particular, in your Python journey you will run into "args" and "kwargs" as arguments passed into your methods and objects. "kwargs" stands for keyword arguments and can be treated similarly to a dictionary.
Here is a nice blog article from one of my favorite hosting providers-- Digital Ocean:
https://www.digitalocean.com/community/tutorials/how-to-use-args-and-kwargs-in-python-3
rickmerc
2,384 Pointsrickmerc
2,384 PointsThanks, Jeff! That article made the video make sense. (It also made it clear that **kwargs is more useful than just putting elements into and out of dictionaries.) Thanks again!
Deividas Paulauskas
3,661 PointsDeividas Paulauskas
3,661 PointsThanks, Jeff, that article was very useful and easy to understand!