Answers for "frequency of ele in arr"

0

frequency of ele in arr

n=int(input("ENTER ARRAY SIZE "))

arr=[]

print("Enter the array elements")

for i in range(n):

    arr.append(int(input()))

x=list(dict.fromkeys(arr))

for i in x:

    print("\n {} occurs {} time(s)".format(i,arr.count(i)))
Posted by: Guest on May-22-2021

Python Answers by Framework

Browse Popular Code Answers by Language