aboutsummaryrefslogtreecommitdiff
path: root/challenge-332/sgreen/python/ch-2.py
diff options
context:
space:
mode:
authorSimon Green <mail@simon.green>2025-08-03 17:54:51 +1000
committerSimon Green <mail@simon.green>2025-08-03 17:54:51 +1000
commit39d8e45fc8a55d48a2b5bbceef09d7a2de1d846e (patch)
tree01264677624c449a5e65dcd01bf7347d4fd82d0d /challenge-332/sgreen/python/ch-2.py
parent6f0d16f05f2773a17829abb2db30dff2c2f73444 (diff)
downloadperlweeklychallenge-club-39d8e45fc8a55d48a2b5bbceef09d7a2de1d846e.tar.gz
perlweeklychallenge-club-39d8e45fc8a55d48a2b5bbceef09d7a2de1d846e.tar.bz2
perlweeklychallenge-club-39d8e45fc8a55d48a2b5bbceef09d7a2de1d846e.zip
sgreen solutions to challenge 332
Diffstat (limited to 'challenge-332/sgreen/python/ch-2.py')
-rwxr-xr-xchallenge-332/sgreen/python/ch-2.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-332/sgreen/python/ch-2.py b/challenge-332/sgreen/python/ch-2.py
new file mode 100755
index 0000000000..8a59970f37
--- /dev/null
+++ b/challenge-332/sgreen/python/ch-2.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import sys
+from collections import Counter
+
+
+def odd_letters(input_string: str) -> bool:
+ """
+ Check if all letters in the input string have an odd frequency.
+
+ Args:
+ input_string (str): The input string to check.
+ Returns:
+ bool: True if all letters have an odd frequency, False otherwise.
+ """
+
+ freq = Counter(input_string)
+ return all(count % 2 == 1 for count in freq.values())
+
+
+def main():
+ result = odd_letters(sys.argv[1])
+ print(result)
+
+
+if __name__ == '__main__':
+ main()