I'm trying to sum each pair of values in this a list. Here's a short example, but I'd like my function to work with any length list.
So, for x = [1,2,3] I'd like to return the value of 12. I want to condense this:
y = 0
for i in x:
y += x[0] + x[1]
y += x[1] + x[2]
y += x[0] + x[2]
return y
I'm not sure if my question is clear, and I'll clarify if there are any questions.