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

Python Code Challenge Lists and Strings

I am on the final step where you have to make the variable greeting. I do not know what to do; I have looked up every Q&A that other people have had with this problem, but none of them have helped me.

greeting_list.py
full_name = "Courtney Arrowood"
name_list = full_name.split(' ')
greeting_list = "Hi, I'm Courtney Arrowood".split(' ')

3 Answers

Hi, I think you should do this instead:

full_name = "Courtney Arrowood"
name_list = ' '.split(full_name)
greeting_list = ' '.split("Hi, I'm Courtney Arrowood")
Cody Te Awa
Cody Te Awa
8,820 Points

Hi Courtney, The 3rd task in the series of questions isn't very explicit. The 3rd task asks you to make the last item of the greeting_list = to the first item in your name_list. Now although you have done this manually by hard coding your name into the greeting_list variable. It is actually asking you to assign the last element of greeting_list to the first element of name_list. This can be done with either

greeting_list[2] = name_list[0] #or greeting_list[-1] = name_list[0]
#You will then need to create the greeting variable by joining greeting_list
greeting = ' '.join(greeting_list) #this joins greeting_list separated by the referenced string which in this case is a space

ps For all this to work you will need to put treehouse back into your original greeting_list string, or alternatively you could remove the space between your first and last name so that there is only 3 string in the array not 4. -Hope this helps! (:

Thank you both for your help. xela888 your way helped me get passed it! :D

Cody Te Awa
Cody Te Awa
8,820 Points

Hey Courtney , just out of pure curiosity, I was just wondering how xela888's answer helped you pass it when her answer doesn't even past the first task because all ' '.split() returns is an empty string no matter what argument is in the split method? (: