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

Nico Romero
Nico Romero
1,365 Points

Be sure to use `.split()` to break apart `available`. Im not sure what that means since I have already used

I have tried using .split() to split both available = "banana split", etc and it gives me "do not change available, so i try just spiting the sting and it still marks it as incorrect. is there something I am miss you? Thank you

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

5 Answers

Brandon Jaus
Brandon Jaus
13,681 Points

You are using the .split() method on the data that is being stored in the available variable. This causes available to reference a list that looks like ["banana split", "cherry", "malted", "malted", "black and white"]. In order for you to pass this challenge, you need declare a variable called sundaes and call the split() method on the variable available. It would like this:

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

Posted to late :laughing:

Brandon Jaus
Brandon Jaus
13,681 Points

Yeah I guess you posted that while I was in the process of typing it out.

You have the right puzzle pieces. You just need to put them together properly.

Remember that even if your code results exactly what the challenge asked for, the code must be the kind of code the challenge is expecting. The challenge is expecting you to call split() then immediately assign whatever you get from that to sundaes. I know, code challenges (especially the Python topic) are very picky!

Try this:

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

I hope this helps :grin:

Happy coding! :tada:

:dizzy: ~Alex :dizzy:

Cole Wilson
Cole Wilson
7,413 Points

Those don't appear to be separated by a comma "," but a semi-colon ";".

Nico Romero
Nico Romero
1,365 Points

Yeah, I tried that as well. I just changed it back, its still giving me the same error. Thank you Cole :)

Nico Romero
Nico Romero
1,365 Points

Wow, Thanks you guys, I didn't know you could do that. None of the examples we did touch on that, I was just trying to use ("; ") to split the variables. Thank you all so much