If - then function with 2 lists

Hi there, I’m just starting with python and dynamo. Could somebody help me?

I’m importing 2 lists in the python script.
list 1 and list 2.
If list 2 is true and it should say predalwap otherwise is should look to list 1.
And she which value it has and continue filling it in accordingly.
The script with one list works (list1)
But if I want to combine it with another list it doesn’t’.
Where did i make a mistake(s)

Copy of the script:
list1 = IN[0]
list2 = IN[1]
temp =

for s in list1:
for k in list2:
if k == ‘true’
elif s == 0:
elif s == 1:
elif s == 2:
elif s == 3:
OUT = temp

Your second for-loop should have a TAB before it.
Indendation in Python is very important.
The if statements should also move to the right one TAB.
Your first if also misses a :

Looks like your input values are paired. In that case you’ll want to use:

for s,k in zip(list1,list2):

This ensures that your code is always looking at list1[i] and list2[i] at the same index.

@U-Sven zip would be the key to your problem just like @Nick_Boyts suggested.

And you don’t need to specify if k == 'true': since k is a boolean and not a string.
So just put in if k:.

list1 = IN[0]
list2 = IN[1]
temp = []

for s,k in zip(list1,list2):
	if k:
	elif s == 0:
	elif s == 1:
	elif s == 2:
	elif s == 3:

OUT = temp

Thanks everybody for the fast explanation.

The method of @Nick_Boyts works fine.
And thanks AmolShah to put it out so clearly :wink: