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

James Joseph
James Joseph
4,885 Points

Phython: 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.

banana.py
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

Actually, 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
James J. McCombie
Python Web Development Techdegree Graduate 21,199 Points

Thanks 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...

James Joseph
James Joseph
4,885 Points

Hi 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
James J. McCombie
Python Web Development Techdegree Graduate 21,199 Points

ah,

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
James Joseph
4,885 Points

Thanks @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 :).