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 trialAmani Alm
287 Pointsstuck in, Use .split() to break the available string Task
For Task # 1 in splinting and Joining, I answered the following; available = "banana split;hot fudge;cherry;malted;black and white" "banana split;hot fudge;cherry;malted;black and white" .split(";") Sundaes= ['banana split', 'hot fudge', 'cherry', 'malted', 'black and white']
I am not sure I get the question. I thought I understood "splitting & joining" but for some reason, I can't pass this task. Help please!
available = "banana split;hot fudge;cherry;malted;black and white"
"banana split;hot fudge;cherry;malted;black and white" .split(";")
Sundaes= ['banana split', 'hot fudge', 'cherry', 'malted', 'black and white']
1 Answer
Steve Hunter
57,712 PointsHi there,
Use the split
method using dot notation on the available
list. Pass in the ';'
as the argument for .split()
. Assign that into sundaes
.
You've got most of that in your code but you've typed a lot of sundaes which are contained in available
. So use that, rather than creating new strings.
Steve.
Elvin Elder
391 PointsElvin Elder
391 PointsI am completely lost on how to assign the split list to sundaes!
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHi there,
Create the variable
sundaes
, follow that with an equals sign and after the equals sign, call thesplit()
method onavailable
using dot notation and put the semicolon in the parentheses surrounded by inverted commas.Like this:
sundaes = available.split(';')
Steve.
Amani Alm
287 PointsAmani Alm
287 PointsThank you!