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 trialIstvan Balogh
1,505 PointsTypeError: combiner() takes 0 positional arguments but 1 was given
I'm stuck at this code challenge, anyone can point me to the right direction?
def combiner():
combined_list = "".join(filter(lambda i: isinstance(i, str), list))
summed_nr = sum(filter(lambda i: isinstance(i, (float, int)), list))
print(combined_list + str(summed_nr))
3 Answers
KRIS NIKOLAISEN
54,972 PointsFrances Angulo, here is a simpler solution although you may come up with a different way to return the string.
Istvan Balogh
1,505 PointsI was going to post the same solution. This challenge took me a long time to solve and I had to look up things online, After my code was getting more and more complicated I found the aforementioned solution and I nearly started to bang my head into the wall when I realised that such a simple code could do the same.
KRIS NIKOLAISEN
54,972 PointsThe function should return the string not print. Make that change and you'll pass. Your current function returns None
which is why you see Didn't get the expected output
Istvan Balogh
1,505 PointsThank you
Frances Angulo
5,311 PointsThese concepts are foreign to me (eg. the .join and even the i for i). Is there a way to complete this challenge using simpler concepts that we've learned in the course? This challenge closes out the concept of super() and class inheritance for me.
Istvan Balogh
1,505 PointsIstvan Balogh
1,505 PointsAfter I have re-read the description of the task, I've updated my code as it calls for a function that takes a single argument, which is a list. Here's my updated code, that comes back with the error message: Didn't get the expected output