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

Don't know how to do the last part of this task...

Can someone please explain how to do part 4 of 4 on the shopping list challenge of python basics. Anything helps!

greeting_list.py
full_name = "Oliver Carnes"
name_list = full_name.split()

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

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

The was adapted from my answer to this question.

The challenge for Shopping List contain 4 parts.

Challenge Task 4 of 4 -- 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.

Strings also have a join() method. The join() method uses a base string as a joiner between items in a list. To join the updated greeting_list into a string, use the join() method on a string containing a single space like this:

greeting = " ".join(greeting_list)

Thanks!