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 Python Basics (Retired) Shopping List Lists and Strings

I have tested the output, yet the code challenge is rejecting my answer.

Python Stage 4 code challenge

full_name = "John Smith"
name_list = str.split(full_name)
greeting_list = str.split("Hi, I'm {}".format(name_list[0]))
greeting = ', '.join(greeting_list)

2 Answers

Hi Ian,

You're joining the list items together with a comma and then a space. You want to join them together with spaces only.

greeting = ' '.join(greeting_list)
Daniel Chan
Daniel Chan
11,787 Points

Jason has seen the found the mistake already, so if interested a tip for debugging Expected Result:

>>> greeting
'Hi, I'm Firstname'

Test Result:

>>> greeting
'Hi,,I'm,Firstname'

But to achieve the expected result all commas need to be replaced by spaces. as Jason suggested

greeting = ' '.join(greeting_list)