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

Erik Nemcik
Erik Nemcik
1,569 Points

What am I missing? :)

Works perfectly in the workspace. I probably misunderstood the exercise. Could you enlighten me?

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

3 Answers

Steven Parker
Steven Parker
231,007 Points

Soooo close!

The challenge said, "Then reassign the menu variable ...". You have everything done, now just put it back into menu.

You actually have it solved if it weren't for one thing. The Challenge description added this additional requirement

"Then reassign the menu variable to use the existing variable{...}"

so if you just preface your menu.format() line with a menu = you'll be good as gold.

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

I'm not sure what you mean by misunderstanding the exercise if it's working? :-)

Just a quick tip: You can shorten the code like this :-)

available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = 'Our available flavors are: {}.'.format(', '.join(sundaes))