Can someone explain whether its python features or what?
new = []
a = [1,2,3]
for i in range(len(a)):
a.remove(a[0])
new.append(a)
print(a)
new
>> [2,3]
>> [3]
>> []
>> [[], [], []]
Why list 'new' consists of empty elements?
Can someone explain whether its python features or what?
new = []
a = [1,2,3]
for i in range(len(a)):
a.remove(a[0])
new.append(a)
print(a)
new
>> [2,3]
>> [3]
>> []
>> [[], [], []]
Why list 'new' consists of empty elements?