Multiply Adjacent Elements
multiplication, python, tuples
Solution
Short and sweet. Remember that `zip` only runs as long as the shortest input.
print tuple(x*y for x,y in zip(t,t[1:]))
Problem
I have a tuple of integers such as `(1, 2, 3, 4, 5)` and I want to produce the tuple `(1*2, 2*3, 3*4, 4*5)` by multiplying adjacent elements. Is it possible to do this with a one-liner?