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

I'm not sure how to complete this task! Anyone have an idea? Any advice would be appreciated!

Thank you for taking the time to have a quick look at this.

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Here is a walk-through for the challenge. Please ask if anything is unclear:

# Task 1 of 4
# Create a variable named 'full_name' that holds your full name.
# Make another variable named 'name_list' that holds your full
# name in list form, split on the spaces. Don't create name_list
# manually, use split!
full_name = "Chris Freeman"
name_list = full_name.split()

# Task 2 of 4
# Create a variable named 'greeting_list' that uses the string
# "Hi, I'm Treehouse" to create a list by splitting on the spaces.
greeting_list = "Hi, I'm Treehouse".split()

# Task 3 of 4
# Almost done! Now, replace the value of "Treehouse" in
# greeting_list with the first item in your name_list variable.
greeting_list[2] = name_list[0]

# 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.
greeting = ' '.join(greeting_list)

this is the solution , are you unclear about something how is it done ?