Noen> alist = [chr(x ^ y) for x in ord1 for y in ord2] Noen> This creates a way too big list... Im not familiar with two for Noen> loops in one, so I cant see whats wrong :( Try: alist = [chr(x ^ y) for (x, y) in zip(ord1, ord2)] Your listcomp nests two for loops. You need to iterate over both ord1 and ord2 at the same time. Skip