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.


merging of strings and integers

I still don't understand why my code is wrong. I know that instead of else in if-else-statement, I could have used the following code to exclude boolean values:

elif isinstance(item, str): list_words.append(item)

But in the question is mentioned that the argument of the function will only consist of strings and numbers. That's why I've used the 'else statement'..

The code works just fine when I run in Atom, but somehow in workspace it doesn't do anything.

What am I doing wrong here?

def combiner(arg):
    list_numbers = []
    list_words = []

    for item in arg:
        if isinstance(item, (int, float)):

    sum_numbers = sum(list_numbers)
    merged_words = "".join(list_words)

    print(merged_words + str(sum_numbers))

2 Answers

You got this Sameer. It's just that the challenge insists on seeing a return statement instead of print.

Thank you for your response. It worked :)

Mark is right and with that change you will pass the challenge. But try the following:

combiner(["apple", 5.2, "dog", 8, "\n"])

combiner(["apple", 5.2, "dog", 8, "\", "n"])

combiner(["apple", 5.2, "dog", 8, "n", "\"])