Currently I have a new list within my loop that for the most part takes creates a new list with almost all the elements of the original list x in data. However, I'm making a conditional that increments a specific index of xnew only if a condition is x[5] is met. Is there a cleaner way to do the following?:
for x in data:
xnew = [x[1],x[2],x[3],x[4],0,0,0]
if(x[5]==2):
xnew[4] = x[8]
elif(x[5]==9):
xnew[5] = x[8]
else:
xnew[6] = x[8]