FAQ: String Methods - Review

Please have a look at the following FAQ, especially the section on formatting code for the forums.

You need to consider the shape of the list you output here, if you’re not sure try printing the output so you know what changes you have made.

For each element i in highlight_poems_details you create a new list consisting of the first three elements of i. In this case what you end up doing is putting the exact same list of lists back together-

[[i[0],i[1],i[2]] for i in highlighted_poems_details] == highlighted_poems_details

So the len of your new list is still 11 and you cannot unpack it into three variables. Working with for loops and append might be your easiest option here. For an alternative you can look into how to unpack with zip but note that the instructions ask for titles, poets and dates to be lists so you need to be careful with the output.

1 Like