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
arshad bhatti
996 PointsUnpacker value starts from index 1 not zero.
Hey, if I assigned same variable name to two different element "var" value is start from index 1 (means it prints 2 not 1) why...? Please see below the function sample:
def unpacker(): return (1, 2)
var, var = unpacker() print(var)
Answer = 2 ( it should be 1 isn't it.)
2 Answers
jhon white
20,006 PointsNo is not, because the last variable been assigned to value of (2).
if you want to get one you should reverse the order of return values.
jhon white
20,006 PointsYou are welcome.
Good luck :)
arshad bhatti
996 Pointsarshad bhatti
996 PointsThanks Now it seems clear.