896+ Capstone Project is Available: Whatsapp: +91-7011258995, Email: sharecodepoint@gmail.com

How to count the duplicate integer element in the list by taking value from user in python

What is list in python : list  like a array. A like contain & storage multiple data type at same time like : integer, string and more. 

In this program i will you how to count the duplicate integer element by taking the value from user. Variable are store, num, find, number and dup. User can enter the radom number in the list. User can enter the element which element he want to find. store.count() to count the duplicate element.
store = []
num = int(input('How much integer element you want: '))
find = int(input('Which element you want to find: '))
print('Enter radon number :')
for i in range(1, num+1):
    print('Enter', i, 'number :')
    number = int(input())
    store.append(number)
    dup = store.count(find)

if dup == 0:
    print('\n No Duplicate Element find in the list')
else:
    print('\n',find,'is repeated at', dup, 'Times')

Output :

How much integer element you want: 5
Which element you want to find: 3
Enter radon number :
Enter 1 number :
2
Enter 2 number :
3
Enter 3 number :
4
Enter 4 number :
3
Enter 5 number :
3
 3 is repeated at 3 Times

Process finished with exit code 0

If you have any doubt regarding the example then leave your doubts in the comment box.

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form