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

Lists and Strings? Solved problem correct but doesnt work ? Help Please

Thats my solution, why doesn't it work for lists and strings part 3

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

2 Answers

It looks like you skipped some parts of step 3. You need to split the "Hi, I'm X", then replace the X with your first nae, and finally join them all back together. Here is the solution I came up with:

full_name = "Anthony Accetturo"
name_list = full_name.split()
greeting_list = "Hi, I'm X".split(" ")
greeting_list[2] = name_list[0]
greeting = " ".join(greeting_list)

Trying to be pythonic doesnt work will with the test grader, makes me skip unnecessary code lol. Thanks that works well and I understand where the issue is.

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

At this point, it's more about following the steps than it is about matching a certain Python style or cleanliness of code :)

Indeed, Its still a long learning process for me to get to coding styles. Its really cool seeing your involved in this program! Thanks for chiming in, I have about 30 videos dedicated to learning python and I have taken a few courses online, so far yours is the best. I have been doing section by section through several different courses at the same time to really understand concepts. That on top of about 40 ebooks ranging from Angry Python(Pen Testing) to Python Desktop apps with TkInter to Working with large datasets lol. Also taking cs50x and cs101, hopefully in a year I can accomplish what I am looking to do.