I’m doing some return calculations and I’d like to do the below as elegantly as possible, but my knowledge of list comprehension is not good enough. (The list x can be any length, not just 4 elements, the elements are floating point numbers).
x = [a, b, c, d]
y = [(a-b)/b, (b-c)/c, (c-d)/d]
Thanks!
This seems plausible, doesn’t it?