Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Dan AndresenCourses Plus Student 636 Points
Changing an item in a list.
The only thing I'm aware of at the moment is to .append() the list. I don't think this is what they're asking for though. How do I remove the "Treehouse" item and replace it with the first item in my name_list?
full_name = "Dan Andresen" name_list = full_name.split() greeting = "Hi, I'm Treehouse" greeting_list = greeting.split()
Orestis Pouliasis5,549 Points
Your code needs a little fix:
full_name = "Dan Andressen" name_list = full_name.split() greeting_list = "Hi, I'm Treehouse".split() greeting_list = name_list
You have use split() after the string "Hi, I'm Treehouse". The last line of code is indexing and says to take index spot 2 (="Treehouse") and then it changes the index spot 2 with the name_list index spot 0(="Dan") I made you understand, couldn't explain it better.