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

gurinder singh
PLUS
gurinder singh
Courses Plus Student 1,422 Points

not understanding the execise

first, I don't know what to with this exercise and I also don't know why and where it's showing me an error.

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

2 Answers

Antonio De Rose
Antonio De Rose
20,885 Points
#considering the first challenge, you've been asked to split the string, on a specific
#character, which is the semicolon

#the way you have copied I guess it is wrong, as I see commas, I suggest you
#to restart the question again

#your approach is correct, 

available.split() # what you miss here, on what basis, are you going to split it,
#that's where the question, had passed the message to use, semicolon
Wade Williams
Wade Williams
24,476 Points

The object of the task is to split the variable "available" using the split() method. You don't need to do anything to the original "available" variable, you just need to split "available" using the split() method.

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