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 trialJames Joseph
4,885 PointsPhython: Join and Split
Hi there, I'm trying to work on this final python challenge and join sundaes but having a hard time:
available = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(';') menu = "Our available flavors are: {}." desert = (", ").join(sundaes) menu.format(desert)
I get "Did you use '.join(", ") ?" But I can't do: desert = sundaes.join(", ") as Task 1 fails
Any one have any ideas ? I'm most likely missing something simple out.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = "Our available flavors are: {}."
desert = (", ").join(sundaes)
menu.format(desert)
3 Answers
James J. McCombie
Python Web Development Techdegree Graduate 21,199 PointsJoin is a string method.
desert = ", ".join(sundaes) will work; remove the parentheses
James Joseph
4,885 PointsHi James, I tried that but I'm now getting an error about :
Didn't find the right series of sundaes and commas in menu
.
James J. McCombie
Python Web Development Techdegree Graduate 21,199 Pointsah,
last step is to replace menu with the complete string, you just need to put your last line as an re-assignment to menu, only missing 'menu =' and your done
menu = menu.format(desert)
James Joseph
4,885 PointsThanks @James, I re-read the question and it makes sense as it was asking to replace it in the last question. Need to read the questions better next time :).
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsActually, James McCombie you are wrong :) Just so you know that this code will still work with parentheses. Just a little note :)
~Alex
James J. McCombie
Python Web Development Techdegree Graduate 21,199 PointsJames J. McCombie
Python Web Development Techdegree Graduate 21,199 PointsThanks for you little note, and what you say may be true, but it wont help James Jospeh in passing this challenge which is why I was answering his question...