def sum_consecutives(x): #[1,4,4,4,4,4,4,4,0,4,3,3,1,1,1,1,1]
#x = str(x)
print(x)
result= []
i=0
while(i < len(x)):
temp = x[i] #1
#print(i)
if(i+1 < len(x)):
while i+1<len(x)and x[i] == x[i+1]:
temp = temp + x[i]
i +=1
i = i+1
result.append(temp)
return result
some_variable = sum_consecutives([1,4,4,4,4,4,4,4,0,4,3,3,3,3,4,1,1,1])
print(some_variable)
0 Comments