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

Dalton Bird
Dalton Bird
1,164 Points

I do not understand the question. I am having a rough time figuring out exactly what the questions wants me to do.

This question makes no sense to me.

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

2 Answers

Steven Parker
Steven Parker
231,236 Points

It looks like you haven't quite finished that last line. But you also have the arguments reversed for join.

Now join is a string method that takes a list as an argument. But here you have applied it to a list and given it a string as an argument. You'll need to switch those around.

Then just provide the argument to format on the last line and you should have it.

Dalton Bird
Dalton Bird
1,164 Points

Thank you, Steven, for your response. But I have attempted to perform the changes you suggested but still have not been able to complete the exercise. I don't think that I am understanding the content of the lesson. Here is the code that I submitted after reading your explanation.

available = "banana split;hot fudge;cherry;malted;black and white" 
sundaes = available.split(";")
menu = "Our available flavors are: {}."
display_menu = available.join(", ")
menu = "our available flavors are: {}.".format(display_menu)```
Steven Parker
Steven Parker
231,236 Points

You were right the first time to join "sundaes" instead of "available". But you needed to swap things around:

display_menu = ", ".join(sundaes)
Dalton Bird
Dalton Bird
1,164 Points

Steven Parker,

The code that you provided allowed me to complete the exercise but I honestly still don't understand why that worked. I thank you for your time but I don't think that I will be able to complete this coursework due to my inability to understand the subject matter.

Steven Parker
Steven Parker
231,236 Points

Dalton Bird,

Temporary learning blocks are not uncommon at all. You might get a different perspective by reading this other forum post titled The Wall. And you might also enjoy this recent episode of The Treehouse Show where it was featured (including my own answer!).

Conrad Cortes
Conrad Cortes
8,418 Points

Hey Dalton stay with it! I'm having a hard time too but I'm pushing through the lessons and I'm finding that now I can go back to the older tasks and complete them on my own now. The later lessons get more advanced but the basics always come back at some point and it clicked for me once it was presented in a new way.