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


creating variable


Chris Shaw
Chris Shaw
26,676 Points

Hi Lisa,

Which task/part are you having trouble with?

Having problems with creating variable named greeting_list that's the string "Hi, I'm X" split on the spaces. I've tried greeting list=name list greeting="".join (greeting list) having a little problem completing this task.

challenge 3, change "Treehouse" in greeting_list to the first item in your name_list variable don't know what t do.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

I've retried the challenge and I'm getting an error now as well. I'm posting my error as well and will report back.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

In the Challenge Step 3, greeting_list starts as an array of items with "Treehouse" as the last item. To replace the "Treehouse"in the list with the first item in name_list you can reference "Treehouse" using greeting_list[2] and the first item using name_list[0].

The assignment is straight-forward:

greeting_list[2] = name_list[0]

Alternatively, since "Treehouse" is the last item, you can use greeting_list[-1]

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The question is asking to split() the string into pieces using the "space" character as the division points and assign the resulting list to a variable named greeting_list.

The string methonsplit() will divide a string based on any substring. The substring used is not included in the results. By default, split() will use a "space" character. To split the string append the split() method to the string:

"Hi, I'm X".split()

Assigning this to greeting_list:

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

Thanks Chris Freeman

ok Ill check back with you