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

Sam Blaha
Sam Blaha
15,146 Points

Confusing and too wordy

I'm clearly never creating a variable named "display_menu" here and yet it works? I don't get why we are being told to do that when we don't need to... I don't understand how being overly wordy or adding things to a lesson they don't really go over in the videos before it is helpful. It may seem simple to those who are good at Python but to us who aren't, it is very frustrating.

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(";")
menu = "Our available flavors are: {}.".format(", ".join(sundaes))
AJ Salmon
AJ Salmon
5,675 Points

You make a good point. From what I can tell, the challenge looks for at least two things: that the variable menu is assigned the string 'Our available flavors are: banana split, hot fudge, cherry, malted, black and white.', and that you use .join() to accomplish that. For example, this code also passes the challenge;

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

But this code doesn't, because .join() is not used;

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

I believe the question is worded that way to help those who might get stuck trying to produce the desired result on just one line. It is kind if tricky, so props to you, you did it in the most efficient way possible.