The Cat In the Hat
September 26th, 2009
I continue to be impressed by the flexibility of list comprehensions, especially in Python. The other day I discovered that I could handle a small but twisty problem quite simply, which I will now share in the style of Dr. Seuss:
[hat[cat] if cat in hat else cat for cat in cats]