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

I don't understand it

available.split(';') enter nothing happen go crazy help me plz and how do I make sundaes variable

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
available.split(';')
Fable Turas
Fable Turas
9,405 Points

You might want to go back and review the video, but your problem is that you have simply called the split function without having the results sent to a variable.. You can create a variable and assign it the value of a function call the same way you create a variable with a known, constant value. So just like you can write: name = 'Bob', you can write: sundaes = available.split(';') In that way the results of the split function are immediately assigned to the 'sundaes' variable,

2 Answers

Easy! you just need to assign the sundaes variable to avaliable.split(';')

available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
LaToya Legemah
LaToya Legemah
12,600 Points

I am learning Python too and I did the same exact thing when doing this challenge. :) You are almost there.
The steps are:

1) Declare the new variable = sundaes 2) Write the variable you want to split = available 3) Put in the split= .split 4) Put in how to split the variable = (;)

I think of it as who, what and how. My new variable points to WHO (available). WHAT do I want to do to it? (split).
Split HOW? (;)

Your codes should look like below:

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

Hope this helps :)