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 trialRicardo Franco
Data Analysis Techdegree Student 16,258 PointsStuck on instances coding challenge
Hello, I created a dummy file in workspaces to test out the results in the Python shell. When I "print" out line 15 in the shell, I get the expected result. I simply changed the command to "return" as per the instructions and I am getting a "Didn't get the expected output" result. I know I am very close and am looking for a nudge. Thank you, in advance, for your assistance.
def combiner(list):
list = ["apple", 5.2, "dog", 8]
strings = []
numbers = []
for item in list:
if isinstance(item, str):
strings.append(item)
else:
numbers.append(item)
strings2 = ''.join(strings)
numbers2 = str(float(sum(numbers)))
return ''.join([strings2, numbers2])
combiner(list)
2 Answers
Steven Parker
231,269 PointsUse the argument that is passed in, don't replace it with a literal. The data the challenge will be testing with will certainly not be the same as what was shown in the example.
And you should only define the function, you won't need to call it yourself.
Ricardo Franco
Data Analysis Techdegree Student 16,258 PointsI get it what you mean by not passing in an argument literal. Give it its own name to isolate it and provide it its own identity. Thanks.
Steven Parker
231,269 PointsI just meant the 2nd line shouldn't be there.
Ricardo Franco
Data Analysis Techdegree Student 16,258 PointsRicardo Franco
Data Analysis Techdegree Student 16,258 PointsI'm not quite sure I understand when you say "Use the argument that is passed in". Per your hint, I removed the call to the function. I will keep troubleshooting in the mean time.