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 trialSteven Cousineau
2,563 PointsBasic Python_Split and Join exercise: Bummer! Didnt find the right series of sundaes and comma from menu.
I can't seem to figure out the fix of this error as my python shell accepts it and looks fine..id appreciate the help.
treehouse:~/workspace$ python
Python 3.5.0 (default, Apr 13 2017, 18:07:59)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
available = "banana split;hotfudge;cherry;malted;black and white"
available
'banana split;hotfudge;cherry;malted;black and white'
sundaes = ";".split(avaliable)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'avaliable' is not defined
sundaes = available.split(";")
sundaes
['banana split', 'hotfudge', 'cherry', 'malted', 'black and white']
menu = "our available flavors are: {}."
menu
'our available flavors are: {}.'
display_menu = ", ".join(sundaes)
display_menu
'banana split, hotfudge, cherry, malted, black and white'
menu.format(display_menu)
'our available flavors are: banana split, hotfudge, cherry, malted, black and white.'
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}."
display_menu = ", ".join(sundaes)
menu.format(display_menu)
2 Answers
pouya yousefi
12,480 PointsTry use it with like this:
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = ("Our available flavors are: {}." ).format(", ".join(sundaes))
Benny Ogidan
17,948 PointsCheck your spelling of available and define your splitter method as you did sundaes = available.split(";")
Steven Cousineau
2,563 PointsSteven Cousineau
2,563 PointsThank you very much everyone for your help. I was going crazy lol.