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 trialSagar Thakkar
8,814 Pointshay can any one help me to understand packing and unpacking more please...
i am still confused about concept please help trying from 2 days
Sagar Thakkar
8,814 Pointsya sure its https://www.facebook.com/thakkarsagar12 its not safe to put full contact detail hear meet me there
3 Answers
Kenneth Love
Treehouse Guest TeacherLet's start with you telling me what you understand about packing/unpacking.
Sagar Thakkar
8,814 Pointspacking is like compressing multiple values in single variable without any distortion in values, and unpacking is getting out individual variables from dict or list or single compressed variable
it is really honer to learn from you kenneth. You are one of my favourite teachers.
Kenneth Love
Treehouse Guest TeacherOK, that's a pretty good start.
packing is like compressing multiple values in single variable
Yep, when we pack values that's exactly what we're doing.
When we unpack values, we take them from an iterable and turn them into either new variables or key/value pairs.
a, b, c = (1, 2, 3)
This unpacks the (1, 2, 3)
tuple into the variables a
, b
, and c
.
**{"name": "Kenneth", "language": "Python"}
This would unpack the dictionary into the key/value pair name="Kenneth", language="Python"
, like we would use as the arguments to a function.
Allison Schaaf
33,322 PointsI found this blog helpful http://agiliq.com/blog/2012/06/understanding-args-and-kwargs/
Sagar Thakkar
8,814 Pointsthanks kenneth
Taraj Shah
21,073 PointsTaraj Shah
21,073 PointsHi Sagar, Being on the same boat and in the same city, would like to catch up. Can I have your contact detail?