Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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()?