Merging a list but keeping Empty list Empty



I want to merge 2 lists
List 1 contains 3 index with 4 value in them
List 2 containt 5 index but index 1; 4; 5 is empty

I want to keep index 1 - 4 -5 empty.

So the should end up being
0 Empty
1 Values
2 Values
3 Values
4 Empty
5 Empty

Thanks in advance :slight_smile:

Hello!
You can try this python script:

i think im doing the pythons script wrong any idea?

Hello Thom,

Indentation matters a lot in Python as it stipulates looping. Please indent lines 18 and 20 as per Tiago’s example :slight_smile:

That’s exactly what @ Sol_Amour said. :stuck_out_tongue:

Holy moly it worked :smiley: Thanks alot
i have no idea how i got that wrong :slight_smile:

just to understand the script a little better, its only using the the 0 right ?
“if item!=0:” ?

so the output would not be corrupted if the value 2 is changed to 3 in the “list map”

Also if the input happend to be “empty list” would it then be possible to replace "if item!= 0: with “if item!= empty list:”

I think this is correct :slight_smile:

if item!=[] :

or

if len(item)!=0 :

Empty list has not meaning in Python :slight_smile: