How does the list comprehension in the example code work?

A little more information would be helpful but if it’s not directly related to this FAQ you could check the FAQ for the main exercise linked in the original post or consider a new query in #get-help.
Prior to this it would be worthwhile reading this FAQ which would help whoever responded and likely get you a better answer.