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
182,341 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.