top of page

Python program to print every index of duplicate element in list

Jun 11, 2020
1 min read

In this program we will print the index of all the duplicate element present in the list.


list1 = ["amul",1,1,1,4,5,6]
list2 = [i for i in range(len(list1)) if list1[i] == 1]
print(list2)
Output:
[1, 2, 3]

Happy Coding!

Follow us on Instagram @programmersdoor

Join us on Telegram @programmersdoor


Please write comments if you find any bug in above code/algorithm, or find other ways to solve the same problem.

Follow Programmers Door for more.

Comments


bottom of page