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

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]