Print all items from list two that differ from the item at the same index in list one
list1 = [1, 9, 4, 8, 7, 1] list2 = [5, 6, 8, 9, 7, 1] print(*[y for x, y in zip(list1, list2) if x != y], sep='\n')
Output
5 6 8 9
list1 = [1, 9, 4, 8, 7, 1] list2 = [5, 6, 8, 9, 7, 1] print(*[y for x, y in zip(list1, list2) if x != y], sep='\n')
5 6 8 9