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

Suraj Shah
Suraj Shah
1,055 Points

combiner challenge

I cannot understand why the following code receives a bummer error

instances.py
def combiner(comb):
    list_of_words = []
    number = 0

    for item in comb:
        if isinstance(item, str):
            list_of_words.append(item)
            string_of_words = "".join(list_of_words)

        elif isinstance(item, (int, float)):
            number += item

    return {}{}.format(string_of_words, number)

1 Answer

Rich Zimmerman
Rich Zimmerman
24,063 Points

format() needs to be called on a string, so you just need to put your {} in quotes. like this

return "{}{}".format(string_of_words, number)