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

Zachary Parke
Zachary Parke
2,796 Points

I've completed 2/3 tasks in this small exercise(Python Basics: banana.py), but I fail on task 3. Task 1 no longer passes

I feel like I may be doing too much? Or I am putting something in the wrong spot. Highly frustrating. I was sure I understood these concept. :\

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

1 Answer

Steven Parker
Steven Parker
229,744 Points

Any syntax error will invalidate the entire program and cause the re-validations to fail. In this case, there seems to be a few:

  • "display_menu" is referenced before it is defined
  • a period missing between the string and "join"
  • a missing argument for the "join"
  • an attempt to combine a string and a list using the "+" operator

Here's a little trick for when you get vague error messages: copy your current code and then reset the challenge and paste it into task 1. The validation for task 1 will often give a more explicit message, even for things that wouldn't normally be added until later.

Zachary Parke
Zachary Parke
2,796 Points

Thank you Steven. This helped me understand why I got this wrong. It turns out I was closer in my initial guesses and then they progressively got worse once I became frustrated. I will ask my questions before I get too upset and start typing out nonsense.