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

Zach Dayton
Zach Dayton
1,580 Points

What am I missing?

Help! I'm having a tough time understanding why this works in workspaces but is not accepted for the answer.

def combiner(sing):
    print(sing)
    count = 0.0
    fin = ""
    for i in sing:
        if isinstance(i, (int, float)):
            count += float(i)
        elif type(i) == str:
            fin+=i
    count = str(count)
    return str(fin+count)

1 Answer

Perhaps try to replace the type() call with another isinstance() call...? I'm having trouble with getting a working function to pass as well (works in command line, code challenge isn't having it...). But maybe that would inch you closer since the challenge revolves around isinstance()?