Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (Retired) Shopping List Lists and Strings

Matthew Seibert
Matthew Seibert
507 Points

Python Challenge

The task is: Almost done! Now, change "Treehouse" in greeting_list to the first item in your name_list variable. Im not to sure what I'm doing wrong.

greeting_list.py
full_name = "Matt Seibert"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()
greeting_list = "Hi, I'm {}".format(name_list[0])

Hi,

Maybe try something like:

greeting_list[2] = name_list[0]

This will replace the item of greeting_list that has the index of 2 with the item of your name_list that is index 0

1 Answer

Simon Leslie
Simon Leslie
23,690 Points

Matthew, you need to replace the word 'Treehouse' in greeting_list (i.e. in the greeting after it has been split into its components.

After line three of your code has executed, greeting_list is a list comprising three elements:

["Hi,", "I'm", "Treehouse"].  

Instead of creating a new string, you want to replace the third item in that list (i.e. "Treehouse") with your name.

Try the following:

greeting_list[2] = name_list[0]