From 19bbe104a6c777e30d9f15bd7101817fccedfd63 Mon Sep 17 00:00:00 2001 From: RATHOD VINIL Date: Tue, 19 Oct 2021 21:41:50 +0530 Subject: [PATCH] Program by vinilRathod To count the frequency of elements in an array. --- frequency_sorted.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 frequency_sorted.py diff --git a/frequency_sorted.py b/frequency_sorted.py new file mode 100644 index 0000000..73f26af --- /dev/null +++ b/frequency_sorted.py @@ -0,0 +1,13 @@ +class Solution: + def frequency(self, A, N): + count={i:0 for i in A} + temp=[] + for i in A: + count[i]=count[i]+1 + print(count) +t=int(input()) +for i in range(t): + n=int(input()) + a=list(map(int,input().split())) + ob=Solution() + ob.frequency(a,n) \ No newline at end of file