Secondly, can someone explain why the output for the code below (from the example), does not split the elements at each line break (\n)? The output in the example seems to show an arbitrary split for each of the elements.
Thirdly, I’m not sure why I continue to get an error explicitly stating undefined variable that I did not create. This part is perplexing because there is not variable ever created or referenced called first_three_lists.
"first_three_lists isn’t defined in your code, but we expected it to be list type"
I can’t seem to find the example you’ve described here for Python Lists and For Loops – could you post the link to the mission you’re working on for us?
The only thing I think I can answer for now is your third question about the undefined variable. For answer-checking purposes, Dataquest needs you to use specific variable names (which are given in the instructions). It sounds like the answer checker was looking for a variable named first_three_lists, but since you didn’t create it (you used first_three I think), it could not check your answer. You’ll always want to use any specific variable names given in the instructions so it can check your code.
I can understand how that would be confusing! To be honest, I’m having trouble understanding the question because I can’t find the same mission so that I can put it in context. I’ve been working on the Analyst with Python path and in the List and For Loops mission on screen 8 looks completely different: https://app.dataquest.io/m/312/lists-and-for-loops/8/repetitive-processes. Sorry I wasn’t more help!
Thanks for the detailed response. I do have a follow-up question to your response. I realize we are splitting on the comma ,, but the output in the diagram shows the first list/element including the orange, blue and yellow segments (my assumption was that it would split after vpp_lic.
I’m just not getting the logic on which commas it’s splitting on because there are so many commas (i.e. id, track_name, etc etc).
Oh, I think the Output shown in the exercise example was incorrect. After reviewing the Output with the correct answer, it does show that it splits on the comma (which prior to was \n), but not sure why the Output in the example shows different.
i.e. the first list does show the brackets/list closing after ‘vip_lic’. etc etc
The first output is a consequence of the line print(first_three). The list first_three has three elements:
This what you see if the first part of the output. These elements have yet not been split on the comma, each of them is a string corresponding in the same order to the orange, blue and yellow parts of the first part of the output.