Hi guys, why does this simple code (Python 3.6.3 on Windows)
test = ["John",[["Doe",123],[],[],[],["Jane",432]]]
remaining_tiles = [x for x in test [1] if x]
for k in remaining_tiles:
print(k)
remaining_tiles.remove(k)
remaining_tiles = [x for x in remaining_tiles if x]
print(remaining_tiles)
print(len(remaining_tiles))
gives me:
['Doe', 123]
[['Jane', 432]]
1
instead of:
['Doe', 123]
['Jane', 432]
[]
0thank you in advance