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.
- Python | Replace elements in second list with index of same element in first list
- Python VLC MediaListPlayer - Playing Item at given index
- Python VLC MediaList - Getting Index of given item
- PyQt5 - Getting the current index of selected item in ComboBox
- PyQt5 - Change the item at specific index in ComboBox
- PyQt5 - Getting the content of item at specific index in ComboBox
- PyQt5 - Adding item at given index in ComboBox
- Python program to sort a list of tuples by second Item
- Python | Inserting item in sorted list maintaining order
- Python - Group single item dictionaries into List values
- Python - Sort list of Single Item dictionaries according to custom ordering
- How to remove an item from the List in Python?
- Python - Filter unequal elements of two lists corresponding same index
- Python | Sort list of list by specified index
- Python | Add list elements with a multi-list based on index
- Python - Sort dictionaries list by Key's Value list index
- Python - Filter the List of String whose index in second List contaons the given Substring
- Python | Equate two list index elements
- Python - Elements with same index
- Python Program that prints rows from the matrix that have same element at a given index
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.