I am trying to check if an item in list 1 is present in list 2 and return a list of values based on items in list 3.
List1: [zero, two, three, four, five, seven]
List2: [one, zero, five, three, six]
The returned list should be: [1,0,7,0,4,0]
My code is listed below, but my returned list is wrong. Can anyone find my error?
Update: I have changed the code to simplify it, but I still don’t end up with a useful result:
I think this might be a bug with the ternary operator inside imperative code:
try an if statement.
@tmdA5HML You can achieve that in Python as shown below:
for item1 in List1:
if item1 in List2:
In if statement codeblock form:
t1 = List.IndexOf(y,x);
Thanks @salvatoredragotta ! This worked perfectly.
I tried an if statement earlier with the same result, but using Python worked. It seemed the for loop was the problem.
Thanks for your help, though!
@tmdA5HML please mark the post as solved