Download New Sharecodepoint Android App from Google Play Store : DocScannerPoint : Document Scanner with OCR, PDF: Download Now


Domyhomework123.com - programming homework help. Get your programming homework done with expert homework helper. Trust Writemypaper123.com with your paper and you will never regret it.

Download Latest Notes, Study Materials and More...

Visit: Download Now


Ask Any Question Relative to your Sujbect

Visit: Ask Question


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.

0 Comments

Post a Comment