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 trialAshikur Rahman
129 PointsStrange 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.
def multiply(*args):
total = 1
for num in nums:
total = total * num
return total
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsYou are So Close! Change *args
to nums
and you're golden!!
Ashikur Rahman
129 PointsAshikur Rahman
129 PointsThank you so much rolling my eye. actually
nums
should be
args
there. I really appreciate your help
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsYes, changing
for num in nums:
tofor 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.