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

seantan4
seantan4
2,771 Points

multiply

I'm getting the Bummer! try again! error I think the code works for args as int but not str. the challenge specifically states that any type of args will do. Not sure how to get the product of str?

twoples.py
def mul(*nums):
    product = 1
    for num in nums:
        product *= num
    return product

2 Answers

Hi!

If you look at the error it says could not find "multiply". You named your function mul. How it is now:

def mul(*nums):
    product = 1
    for num in nums:
        product *= num
    return product

How it should be:

def multiply(*nums):
    product = 1
    for num in nums:
        product *= num
    return product

Hope this helps!

Thanks!

seantan4
seantan4
2,771 Points

Thanks alot Aayush!