May-09-2020, 10:13 PM
I'm working on a problem in which I'd like to compare two lists of numbers:
list_a = [0, 1, 2, 3] list_b = [4, -2, 3, -1]Then, I'd like to create a new
list_c
that transforms the list_a
by examining every negative number in list_b
and then replaces the corresponding number in list_a (at the same index number when compared to list_b
) with None.list_c = [0, None, 2, None]I welcome your suggestions on what would be the most efficient way to achieve this. Thank you.