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

Kushagra Patel
Kushagra Patel
7,740 Points

Solution Check Advice

hi fellow learners I want to know does my solution approach is correct? Challenge gets passed.

twoples.py
def multiply(*args):
    multi=1
    for i in args:
        multi=multi*i
    return (multi)


call=multiply(2,3)
print("multiplication of the numbers : {}".format(call))

1 Answer

You have the right idea. A couple of small things: no need to put () around multi. It's a number so you just need to return it. And I would call the variable something more accurate and clear, like product, instead of multi. Remember that coding is a form of communication -- make it easier for others to read and understand your code by using good variable names. This is important when you're working with others.

Kushagra Patel
Kushagra Patel
7,740 Points

thanks a lot for your advice