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

Chris Parker
Chris Parker
1,391 Points

Oops! It looks like Task 1 is no longer passing.

For the code below all is good up until stage 3 when I'm asked to "change "Treehouse" in greeting_list to the first item in your name_list variable." Doing this the way I have in the last line alters the values stored in the name_list variable resulting in Task 1 (which was to create the name_list variable with the specific values) to now fail.

Any suggestions on how to get round this?

full_name = "Christopher Parker"
name_list = list(full_name.split())

greeting_list=("Hi, I'm TreeHouse").split()

name_list[0]=greeting_list[2]
Philip Cox
Philip Cox
14,818 Points

Hi, You don't need to use list and .split() together. This is probably the reason for your error.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Very close! but backwards: It's asking to change greeting_list by replacing the "Treehouse" with your first name (name_list[0]). See other comments on your code below:

full_name = "Christopher Parker"
name_list = full_name.split() # <-- split() returns list. No need to wrap with list()
greeting_list = "Hi, I'm TreeHouse".split()  # <-- parens around string not needed

greeting_list[2] = name_list[0] #<-- flipped so greetlng_list item gets changed
Chris Parker
Chris Parker
1,391 Points

That did the trick! Thanks Chris + Phil for the help!