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

Manuel Cisera
Manuel Cisera
4,250 Points

Create a function named combiner that takes a single argument, which will be a list made up

it says that the operation += can't be done fot int + list and i don't know how to fix it

instances.py
def combiner(args):
    sums = 0
    words = ""

    for arg in args:
        if isinstance (arg,str) == True:
            words += arg
        elif isinstance (arg,(int,float)) == True:
            sums += args

    answer = words + str(sums)
    return(answer)

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

You are so close!

sums += args

# should be

sums += arg  # drop the last ā€œsā€