I have a list of numbers such as [1,2,3,4,5...], and I want to calculate (1+2)/2 and for the second, (2+3)/2 and the third, (3+4)/2, and so on. How can I do that?
I would like to sum the first number with the second and divide it by 2, then sum the second with the third and divide by 2, and so on.
Also, how can I sum a list of numbers?
a = [1, 2, 3, 4, 5, ...]
b = sum(a)
to get one number?
This doesn't work for me.