T
Terrance N. Phillip
Given a and b, two equal length lists of integers, I want c to be
[a1-b1, a2-b2, ... , an-bn]. I can do something like:
c = [0] * len(a)
for ndx, item in enumerate(a):
c[ndx] = item - b[ndx]
But I'm wondering if there's a better way, perhaps that avoids a loop?
Nick.
(I seem to recall from my distant past that this sort of thing was dead
easy with APL... c = a-b, more or less.)
N
[a1-b1, a2-b2, ... , an-bn]. I can do something like:
c = [0] * len(a)
for ndx, item in enumerate(a):
c[ndx] = item - b[ndx]
But I'm wondering if there's a better way, perhaps that avoids a loop?
Nick.
(I seem to recall from my distant past that this sort of thing was dead
easy with APL... c = a-b, more or less.)
N