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()

Mitchell Sawicki
Mitchell Sawicki
1,240 Points

I am not sure what the question is looking for on the ".split()" exercise #1. I believe I have entered it correctly.

I have entered the code as Kenneth had displayed it but it keeps coming back as "bummer". Bummer indeed!

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
available = "banana split;hot fudge;cherry;malted;black and white".split(";")
sundaes = ['banana split', 'hot fudge', 'cherry', 'malted', 'black and white']

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Mitchell,

You seem a bit off track here. The challenge is asking for a new variable that will hold the split list. For some reason you are re-assigning the value of the original variable and then hard-coding a dictionary into the asked for variable.

You are using the correct method .split(), but just not the way the challenge is asking it to be used. Here, you would use it on the variable (which holds the value) to be split.

So, the first task will look like this:

available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")

See, there is the variable available that holds a string. Then you split the string up on the semicolons and assign it to sundaes.

I hope this helps and makes some sense. :)

Just a note: If you are brand new to coding ... I would suggest not starting with Python. If you have basic coding experience, it may be okay, but I would recommend going through Treeehouse's Digital Literacy Track first before diving into any language (especially Python). This track will provide all the basics of "Computer Science" and code needed to enter the coding world and will be of great benefit in helping the more complex languages make more sense.

Anyways, welcome to Treehouse. :smile:

Keep Coding! :dizzy: