I’m working on a problem in which I’d like to compare two lists of numbers in Python:
list_a = [0, 1, 2, 3]
list_b = [4, -2, 3, -1]
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! Thank you.