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 trialKevin Selagea
2,161 PointsHow do I split lists?
I'm having a hard time splitting lists.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = "banana split; hot fudge;cherry; malted; black and white"
sundaes.split(";")
hamsternation
26,616 Pointshamsternation
26,616 PointsYou are really close but you had the split backwards.
Think of it this way, whatever the .split gets attached to gets split. So if you attach
.split(';')
to the variableavailable
, the list will get split up. Like this:This however, only returns a list of the items split up. You then need to assign this list to a variable, called
sundaes
:Once assigned, the variable
sundaes
now represents the list and can be called whenever you need a list of the sundaes. :)I hope that helps!