0
How to clear values in list without affecting the dependant list??pls answer
I've attached the code (input = 1,2,3,4) The desired output is: [[1,2 ],[3,4 ]] But the output is [[ ],[ ]] Pls answer.. https://code.sololearn.com/czYHB4TDI5Mr/?ref=app https://code.sololearn.com/czYHB4TDI5Mr/?ref=app
3 Answers
+ 2
little change in line 7
data.append(data2[::])
+ 3
l=[1,2,3,4]
x=[[l[i],l[i+1] ] for i in range(0,len(l),2)]
print(x)
I hope it helps!!!
+ 2
Thank you very much for your responses.