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

Tristan bradford
Tristan bradford
1,123 Points

How come my answer is wrong?

I tried this code in a different IDE and it worked just fine when I printed it, but I feel like I'm missing something small here.

greeting_list.py
full_name = "Tristan Bradford"
name_list = full_name.split()
greeting_list = "Hi, I'm " + name_list[0]

3 Answers

greeting_list is supposed to be a list, but you're making it a string.

Bryan Manhollan
PLUS
Bryan Manhollan
Courses Plus Student 7,863 Points

Make use of .format after the string in order to change the name. Then use split() to make it a list.

Tristan bradford
Tristan bradford
1,123 Points

I made full list 0 = greedings list 2 and it worked. Thank you for the help everyone!

Bryan Manhollan
Bryan Manhollan
Courses Plus Student 7,863 Points

The best way to do it would be

greeting_list = "Hi, I'm {}".format(name_list[0]).split()

Glad you got it to work.