Python | Find mismatch item on same index in two list
Given two list of integers, the task is to find the index at which the element of two list doesn’t match.
Input: Input1 = [1, 2, 3, 4] Input2 = [1, 5, 3, 6] Output: [1, 3] Explanation: At index=1 we have 2 and 5 and at index=3 we have 4 and 6 which mismatches.
Below are some ways to achieve this task.
Method #1: Using Iteration
Method #2: Using list Comprehension and zip
Method #3: Using Enumerate
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course