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

jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Stuck again.

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

What's wrong?

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

2 Answers

Afrid Mondal
Afrid Mondal
6,255 Points

Your code seems fine to me. But instead of assigning the string directly use variable. Like...

available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Thanks Afrid. I appreciate it.

Hi Jamie,

Your code technically works, but the instructions say: "Use .split() to break the available string apart on the semi-colons (;). Assign this to a new variable sundaes."

They just want you to use the available variable.

So:

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

Best, Cena

jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Thanks Cena. I appreciate your time