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

Ashikur Rahman
Ashikur Rahman
129 Points

Strange error on twoples.py

Hi! I feel my code is ok at least the function name is correct. But challenge showing an error message "couldn't find multiply". Anything helpful from you will be appreciated.

twoples.py
def multiply(*args):
    total = 1
    for num in nums:
        total = total * num
    return total

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

You are So Close! Change *args to nums and you're golden!!

Ashikur Rahman
Ashikur Rahman
129 Points

Thank you so much rolling my eye. actually

nums 

should be

args 

there. I really appreciate your help

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Yes, changing for num in nums: to for num in args also works!

Since you are expecting exactly one argument, using a leading * can mislead other programmers into thinking more than one argument is OK. It would better to use plain arg in this case.