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 trialIdan shami
13,251 Pointspacking challenge, I don't understand what I need to do in this challenge
I literally don't know what to do in this packing challenges, what the challenge asking from me to do?? I'm so frustrated, feel like I can't complete the challenges... please help.
def multiply(*args):
for value in args:
2 Answers
Steven Parker
231,269 PointsSince you used args as a loop iterator, I'll assume you understand how the unpacking (AKA "splat") operator works. So what the challenge wants you to do is multiply all the arguments with each other.
So if someone called "multiply(3, 4, 5)
" what the function would do is calculate 3 * 4 * 5
and return the result 60 back to the caller. You just need to program this so it will handle any number of arguments.
ilya A
3,802 Pointsyou forgot def in the begging of line 1
Idan shami
13,251 PointsIdan shami
13,251 Pointsok, did it like this:
sometimes I get frustrated with easy things like that...
Steven Parker
231,269 PointsSteven Parker
231,269 PointsGood job! (I'm sure the version that passed the challenge had a "def" in front).
Happy coding!