I'm new to Python and I'm wondering is there a way to streamline this clunky code I've written. Maybe a built-in function I've never come across before?
I run through two lists of binary numbers and if the same number appears at the same index in list one and two, do x.
So in the example below the number 1 appears at index 2 in both lists.
list1 = [0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
list2 = [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]
for position, binary in enumerate(list1):
for placement, number in enumerate(list2):
if position == placement and binary == 1 and binary == number:
do x