I have this one line comprehension and am trying to break it down to understand it:
units = dict((s, [u for u in unitlist if s in u]) for s in boxes)
So far I have come up with this but it doesn't give the same output:
u = []
for s in boxes:
for u in unitlist:
if s in u:
u.append(u)
units = dict(u)
please advise, and also please guide me to any place i can understand how to switch between the two better. I find it easier to understand code without the one liners.