This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_array = list() | |
num = input("Enter how many elements you want:") | |
print ('Enter numbers in array: ') | |
for i in range(int(num)): | |
n = input("num :") | |
num_array.append(int(n)) | |
result = dict([(x,num_array.count(x)) for x in num_array]) | |
print (result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_array = list() | |
num = input("Enter how many elements you want:") | |
print ('Enter numbers in array: ') | |
for i in range(int(num)): | |
n = input("num :") | |
num_array.append(int(n)) | |
result = dict([(x,num_array.count(x)) for x in num_array if num_array.count(x) > 1]) | |
print (result) |