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

Challenge Task 3/4

What's the first step to turning Treehouse to my name in this task?

greeting_list.py
full_name = "OLivia Yen Chau"
name_list = full_name.split()

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

1 Answer

Bart Bruneel
Bart Bruneel
27,212 Points

Hello Olivia,

So basically there are now two lists.

The first is the name_list=["Olivia", "Yen", "Chau"]

The second is the greeting_list=["Hi,", "I'm", "Treehouse"]

So the first element of name_list needs to be swapped with the third element of the greeting_list. Remember that indexing in Python starts at zero. So switching the two values can be done like this:

greeting_list[2]=name_list[0]