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

Combiner Task Starter

I haven't finished this task yet but was trying out the code that I do have and kept getting "None" returned instead of the list of integers and strings. Does anyone know why that is?

instances.py
int_list = []
str_list = []

def combiner(list):
    for item in list:
        if isinstance(item, int) == True:
            ints = int_list.append(item)
            print(ints)
        elif isinstance(item, str) == True:
            strings = str_list.append(item)
            print(strings)

combiner([10, 'red', 'apple', 5])

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,426 Points

All defined functions have an implicit return statement as the last statement. The return without an accompanying expression will return None. Since you do not have a return statement, the function will always return None.