Today we are going to share a Program to print duplicates number from a given list. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a Program to print duplicates number from a given list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | def display(list1): final_list = [] for num in range(len(list1)): i = num + 1 for i in range(i, len(list1)): if list1[num]== list1[i]: final_list.append(list1[num]) return final_list list1 = [5, 6, 10, 15, 5, 2, 15, 6] print(display(list1)) |
[5, 6, 15]
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.