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 (2015) Python Data Types Use .split() and .join()

Lewis Mansbridge
Lewis Mansbridge
1,119 Points

Hi ! Please can i have some help, stuck on this task and not too sure on the concept of lists in general

Would anyone know a website where I can try abit more on lists and try to get more of an understanding? Thanks for the help :)

banana.py
available = "banana split;hot fudge;cherry;malted;black and white".split(;)
// Sundays = something or rather not sure :( //

1 Answer

Lists are the equivilant of Arrays in Java. They work to store a series of data under one variable, and allow you to perform operations similar to what you would do in real life with a [shopping, todo, inventory] list. These include running over the list and performing an action on each item. This is called iteration and Python does contain other iterables.

available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(';')

Will be the equivilant of

sundaes = ['banana split', 'hot fudge', 'cherry', 'malted', 'black and white']

I hope that this helps.