Average of numbers

I have the left list in shot with sub-lists with variable lengths … I need to got the right list as shown with the average number inserted in the right index.

Appreciate your help as always.

I am looking into this right now, but i am going home soon. Will try this later tonight.

A possibility using Python:

lists = IN[0]
out = []

for list in lists:
	out.append([])
	for x, num in enumerate(list):
		if x == 0:
			out[-1].append(num)
			continue
		out[-1].append(float(num + list[x-1])/2)
		out[-1].append(num)

OUT = out

image

5 Likes

You are amazing as usual Thomas … Thank yo so much.

1 Like

Wow that is a lot smaller than i imagined! I need to learn python better myself to be able to write something like this!

1 Like

Yeah we need to learn it … It’s like a magic. He is always surprise me with his quick accurate simple solutions.