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

Bridie Begbie
Bridie Begbie
785 Points

greeting list step 4 help?

Can anyone explain why my last line of code isnt working?

I'm assuming they are asking me to add third part of greeting_list ("treehouse") to the beginning of the name_list. Have I understood that correctly?

Thanks

greeting_list.py
full_name = "Bridie Begbie"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split( )

name_list.insert(0,greeting_list[2])

2 Answers

Hi Bridie

The challenge asks you to change the word Treehouse in greeting_list with your first name. You cannot use insert because that inserts a new value into the list not change its value.

full_name = "Bridie Begbie"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()
greeting_list[2]=name_list[0]
greeting=" ".join(greeting_list)

I had the same issue, and I finally got it. Thanks a million Andreas!

Bridie Begbie
Bridie Begbie
785 Points

Ah, thanks for that. I think the task could have bern worded more clearly!