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 dont know how to get through this exercise

I dont undersntand what it means by iutem and "Treehouse"

greeting_list.py
full_name = "bruna stephanie silva"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()

3 Answers

rydavim
rydavim
18,813 Points

Welcome to Treehouse!

I believe they're asking you to manipulate the two lists you have in order to change 'Treehouse' to be your first name.

# You can get the item 'Treehouse' from greeting_list using it's index.
# Then, you can set it equal to the first item in name_list using it's index.
greeting_list[2] = name_list[0] 

Hi Thank you so much for your help but I still cant pass it. I tried full_name = "bruna stephanie silva" name_list = full_name.split() greeting_list = "Hi, I'm Treehouse".split() greeting_list[2] = name_list[0]

but it didnt work

I dont understand how to get items from index and do not understand how to make "Treehouse" the first item on name_list

Thank you!

rydavim
rydavim
18,813 Points

Hmm, the code you posted in your comment works for me up until stage four of the challenge. Can you elaborate on where you're getting stuck? I'm definitely not a Python expert, but I think we can probably work it out for you.

As far as indexes are concerned, you're using a number to fetch a value. So you have the list ["bruna", "stephanie", "silva"] so the index of 0 is "bruna", the index of 1 is "stephanie" and the index of 2 is "silva". Think of it as counting the number of things, but you're starting at zero instead of one.

You can use list[number] to retrieve values at that index of number. Does that make sense?

As for the last part of the challenge, the syntax for join is a little bit different than the one for split, but it's the same idea.

greeting = " ".join(greeting_list) # This is joining the items in the list back together, putting spaces between them.

Hey Thank you so much! I've figured it out :)