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

Brandon Wash
PLUS
Brandon Wash
Courses Plus Student 1,186 Points

Can anyone help me out and tell me what I did wrong?

Great! Finally, make a variable named greeting where you join greeting_list back into a string, separated by spaces. You should end up with "Hi, I'm <your first name>" as the value of greeting

greeting_list.py
full_name = "Brandon Wash"
name_list = full_name.split()
greeting_list = "Hi, I'm Brandon".split()
greeting_list[len(greeting_list)  - 1 ] = name_list [0]
Matthew Proudman
Matthew Proudman
11,879 Points

look at the split() function, and go over your programming logic on line 4 this one is bit tricky as it is asking you something complex but just go over what the task is one step at a time.

1 Answer

Logan R
Logan R
22,989 Points

No idea where you got the last line from.

What it wants you to do is use the join operator.

' '.join(list)

So in your case:

greeting = ' '.join(greeting_list)

What ever you put in between the two ', the list will be joined with those symbols.

So if you had:

greeting_list = "Hi, I'm Brandon".split()
greeting = '555666'.join(greeting_list)

You would get out