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

Python Python Collections (2016, retired 2019) Tuples Packing

Shih Kai-Wen
Shih Kai-Wen
613 Points

About challenge

I am stuck with this challenge, and below is my code, can anyone tell me how to fix it???

twoples.py
def multiply(first,*second):
    product=first
    for item in second:
        product*item
    return product

1 Answer

andren
andren
28,558 Points

Inside the loop you multiply product and item together but you don't do anything with the result of that computation. You have to either store the result back into product like this:

product = product * item

Or use the *= shorthand which does the same thing but requires less typing like this:

product *= item