From 379206ccf0a24111b37b9c6996dc21fe576a3e6b Mon Sep 17 00:00:00 2001 From: David Ferrone Date: Mon, 11 Mar 2024 18:17:44 -0400 Subject: 5 Years of PWC! --- challenge-260/zapwai/python/ch-1.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 challenge-260/zapwai/python/ch-1.py (limited to 'challenge-260/zapwai/python/ch-1.py') diff --git a/challenge-260/zapwai/python/ch-1.py b/challenge-260/zapwai/python/ch-1.py new file mode 100644 index 0000000000..4de8664aea --- /dev/null +++ b/challenge-260/zapwai/python/ch-1.py @@ -0,0 +1,27 @@ +def has_uniq_freq(l): + freq = {} + for item in l: + if item in freq.keys(): + freq[item] += 1 + else: + freq[item] = 1 + gq = {} + for v in freq.values(): + if v in gq.keys(): + gq[v] += 1 + else: + gq[v] = 0 + for v in gq.values(): + if v > 1: + return 0 + return 1 + +def proc(l): + print("Input:", l); + print("Output:", has_uniq_freq(l)) + +l1 = [1,2,2,1,1,3] +l2 = [1,2,3] +l3 = [-2,0,1,-2,1,1,0,1,-2,9] +for l in [l1, l2, l3]: + proc(l) -- cgit