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

isinstance challenge: It works on a code editor but not here

Hi, to have some more detail on the error, I started this challenge on a code editor.

When I print the code bellow, the output is what they are asking for. So I just replaced the "print" by "return" but I keep getting the error "Bummer: Try again!"

Could someone please help me?

Thank you

instances.py
def combiner(list):
    string = ""
    numbers = 0
    for item in list:
        if isinstance(item, (int, float)):
            numbers += item
        elif isinstance(item, str):
            string += item
    return(string+str(numbers))

1 Answer

Steven Parker
Steven Parker
231,275 Points

This looks OK to me. So I pasted it directly into the challenge and it passed!

Try again?

It passed indeed! But yesterday I tried quite a few times, even after reloading the page and was not working.

Thank you!