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

I've got nothing else to try

Kenneth's open ended challenges are nothing but frustrating to a young coder. While I can understand the value in requiring problem solving an collaboration, we are too early in this process to synthesize new code without examples given on how to use the tools that we are required to use to complete these. I have not other question other than to just say I'm stumped, frustrated and feel like this is an inefficient way to teach.

I would like a constructive way to provide this feedback rather than just complaining in this forum.

instances.py
def combiner(list=[]):
    numbers = []
    strings = []
    for item in list:
        if isinstance(item, str):
            strings = strings.append(item)
        elif isinstance(item, float) or isinstance(item, int):
            numbers = numbers.append(item)

    all_strings = "".join(strings)
    sum_numbers = sum(numbers)
    return all_strings + sum_numbers

3 Answers

not so far indeed well done keep going

def combiner(list):

string = ''
nums = 0


for item in list:
    if isinstance(item,str):


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


        nums+= item
return string+str(nums)

You shouldn't be frustrated, you are almost there.

You only have 2 mistakes

1.

strings = strings.append(item)

You don't need the assignment here, append does its thing in-place. If you assign the result of the operation, your variable strings will get set to None which is the result of the operation.

2.

return all_strings + sum_numbers

You can't add a string to a number. You'll need to cast the value of sum_numbers to str, with str(value_to_be_casted)

A quick suggestion:

elif isinstance(item, float) or isinstance(item, int):
# this can be replaced with
elif isinstance(item, (float,int)):

Finally, not that is going to impact the code challenge but avoid using the name list for a parameter name as it's a built-in keyword in python. Eg. you wouldn't be able to use list("foobar") because you redefined it as an empty dictionary.

Well done, and don't be so hard on yourself.

Ups and downs a part of growing as a dev.

Thank you both for your help. My frustration is because I know that I am close, but I don't have a strong grasp of the details of code. I understand that is part of the process and that seeking help is necessary and educational. I am used to being self sufficient and get frustrated when I can't be. I appreciate the help from both of you. Thank you again.

I totally agree that Kenneth's teaching style moves very quickly and does not break things down well enough to make sense to a young coder. I feel like I'm just typing behind. him and not really taking a lot way - I've had to look up other tutorials online in order to make sense of what he's saying. On top of that the open-ended challenges that just say "Bummer try again" are not helpful and are really discouraging.