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


help me

def multiply(*args):
    pro = pro*args
    return pro

1 Answer

Samuel Ferree
Samuel Ferree
31,722 Points

The way the method is defined, args is passed in as a list. We know we can iterate through a list with 'in', I've stubbed out some code for you, see if you can finish the function to correctly compute the product of all the args passed in

You'll want to keep multiplying product by each arg in the list, and storing the result back into product

def multiply(*args):
    product = 1
    for arg in args:
        #your code here
    return product