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

instances

guys im still having trouble here please help

instances.py
def combiner(str_num):
    str_num = ["mom", "eldrine", "kiki",8, 5, 8, 5, 2, 3]
    nums = []
    strings = []
    for item in str_num:
        if isinstance(item, str):
            strings.append(item)
        elif isinstance(item,(int,float)):
            nums.append(item)
    nums = sum(nums)
    strings = "".join(strings)       
    return strings + str(nums) 

2 Answers

You are so close!

Your function, combiner, takes an argument, (str_num). However, on line 2, you override the value of str_num and give str_num the value ["mom", "eldrine", "kiki",8, 5, 8, 5, 2, 3].

So when the function is run, no matter what is provided as str_num, the output will always be "momeldrinekiki31".

Remove line 2 and it will work.

Thanks Simon that was very helpful