aboutsummaryrefslogtreecommitdiff
path: root/challenge-332/packy-anderson/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-332/packy-anderson/python/ch-2.py')
-rwxr-xr-xchallenge-332/packy-anderson/python/ch-2.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-332/packy-anderson/python/ch-2.py b/challenge-332/packy-anderson/python/ch-2.py
new file mode 100755
index 0000000000..35ef8de93f
--- /dev/null
+++ b/challenge-332/packy-anderson/python/ch-2.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+from collections import Counter
+
+def odd_letters(str_val):
+ for k,v in Counter(list(str_val)).items():
+ if v % 2 == 0: return 'false'
+ return 'true'
+
+def solution(str_val):
+ print(f'Input: $str = "{str_val}"')
+ print(f'Output: {odd_letters(str_val)}')
+
+print('Example 1:')
+solution("weekly")
+
+print('\nExample 2:')
+solution("perl")
+
+print('\nExample 3:')
+solution("challenge")