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 Shopping List Project

Code Challenge: Lists and Strings HELP!

I've been doing this challenge for a while now because of one thing. I can not figure out how to split my name from Ethan Bottoms, to just Ethan. Everything in the greeting is correct except this! Please help!

Here's my Code so far:

full_name = 'Ethan Bottoms'
name_list = full_name.split()
greeting_list = "Hi, I'm {}".format(full_name).split()
greeting = ' '.join(greeting_list)

4 Answers

Ahmed Elsawey
PLUS
Ahmed Elsawey
Courses Plus Student 3,527 Points

Hey Ethan, I would make a variable which has your name split up in a list. Then format it so it only uses the first item of your list.

name = "Ethan Bottoms"
my_list = name.split()
greeting_list = "Hi, I'm {}".format(my_list[0])

Hope that helps!

Hi Ethan, I did some changes to your code and here's what i came up with

full_name = "Ethan Bottoms"

name_list = ["Ethan" , "Bottoms"]

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

greeting = greeting = ' '.join(greeting_list) 

what was wrong with your code that in the 1st step it told you to make a list but you used the split function and it told you on the 2nd step to make a sentence saying "Hi, I'm Ethan" but you tried to use the format function

It's OK i got stuck on this to!!

I hope that this helps!!!

blessings ~Josh~

Hi Ethan, I think Ahmed is right except for his greeting_list which, in fact, is a string. Small adjustment will fix it.

name = "Ethan Bottoms"
my_list = name.split()
greeting_list = ("Hi, I'm {}".format(my_list[0])).split()

Greetings!

Russell Holz
Russell Holz
4,811 Points

Hey, so I couldn't get any of the above answers actually work, I figured it out according what Kenneth taught us so far. If you jump back to the first video it becomes super clear.

full_name="Russell Holz" name_list=full_name.split() greeting_list="Hi, I'm Treehouse".split() greeting_list[2]=name_list[0]

We create the separate list and then exchange the item at the 0 index of name_list (i.e. Russell) for the item at the 2 index of greeting_list (i.e. Treehouse). Hope that helps.