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

Why am i getting an unexpected output ?

I don't understand why I'm getting an unexpected output. Please help

instances.py
def combiner(*args):
    number_list = []
    string_list = []
    if isinstance(args, (int, float)):
        return number_list.append(args)
    elif isinstance(args, str):
        return string_list.append(*args)

    num = sum(number_list)
    con = ''.join(string_list)
    print(str(num) + con)

1 Answer

Steven Parker
Steven Parker
231,275 Points

The instructions say this will be a function "that takes a single argument, which will be a list ...".

But the packing operator ("*") is only used for a function that takes multiple arguments that you want to combine into a list.