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

Akeno Morrell
Akeno Morrell
2,239 Points

Challenge task 2

full_name = "Akeno morrell" name_list = full_name.split() greeting_list = ["Hi, I'm X"]

This what i have so far and you can only split on strings not list so how do i convert the list back to string to call the method split on it

2 Answers

Akeno Morrell Challenge 2 says greeting_list is a string. Meaning collection of word(s) then split on white space. So

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

So, now greeting_list will be ["Hi,", "I'm","X" ]. If you wonder how greeting_list become list.

split() function splits the string by white space and outputs list.

So when you use split() with "Hi, I'm X". split() function splits the string by white space.

I hope it helps.

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Don't put the string INTO greeting_list, make greeting_list FROM the string.