Sharecodepoint popular queries

Saturday, 1 December 2018

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())
    dup = store.count(find)

if dup == 0:
    print('\n No Duplicate Element find in the list')
    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 :
Enter 2 number :
Enter 3 number :
Enter 4 number :
Enter 5 number :
 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.


Post a comment


Version - 2016 - 2020 - © Sharecodepoint | Made in India. | Copyright Content | Facebook | Twitter | Instagram | Youtube