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 trialAdam Teale
10,989 Pointstest not passing - multiplied values tuple function
Hi guys,
As far as I can understand the question this does work. Any ideas? Thanks! Adam
def multiply(args):
total = args[0]
for a in args:
total = total * a
return total
1 Answer
Tobias Edwards
14,458 PointsYour function can take ANY number of arguments so you'll need an asterisk before your args inside the function parentheses.
As you've set your total to the first number passed into your function, when you loop through all the numbers passed in and multiply total you will be multiplying the first number by itself. To get around this issue you can just set total to 1 initially.