We have a list of numbers, for example, [1,1,1,1,2,2,3,4,5,3,3,3,11,12].
Because we have four 1's, two 2's, etc. The new list would be as followed: [1,4,2,2,3,1,4,1,5,1,3,3,11,1,12,1].
I have the following code, but I am stuck. Can anyone give me advice?
def rlEncode(data):
for i in range(len(data)):
n = data[0]
if n == data[n+1]:
n = n + 1
else:
n = 1
print(n)