Make me beautiful (code needs help)

Emile van Sebille emile at fenx.com
Tue Jul 23 11:15:26 EDT 2002


Mark
> Ok, I have the following data:
> 
> data["A"] = [1,2,4,10,50]
> 
> and I want to get:
> 
> data["new"] = [?, 1, 2, 6, 40]


>>> A = [1,2,4,10,50]
>>> ['?']+[a-b for b,a in zip(A,A[1:])]
['?', 1, 2, 6, 40]

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list