For Loop Question, specific to Thread Shed Project

Project in Question:

My question is on Question 19, where we separate our thread_sold list into specific colors.
On the CodeCademy video (Python Project Thread Shed - YouTube), the programmer uses the code

thread_sold_separated = ‘[ empty list ]’
for x in thread_sold:
for y in x.split(’&’):

and that gives a list with each color separated. I tried using my own method:

thread_sold_separated = [ empty list ]
thread_sold_separated_x = [ empty list ]
for x in thread_sold:
for y in thread_sold_separated_x:

However, that just creates a list with each letter instead of the color. Can somebody explain the difference between the two codes? Please and thank you!

I think the best option might be getting some print functions in your code to see the what structure your names have whilst being looped through. It’s some basic debugging but it’s very helpful to get used to as it’s so often useful.

What’s the different between what you iterate through and what the given solution goes through?

Some useful points-

x = "1,2,3,4" # split always creates a list: print(x.split(",")) # Iterating through a string returns element by element (characters): for character in x: print(character)