diff options
Diffstat (limited to 'challenge-332/sgreen/python/ch-2.py')
| -rwxr-xr-x | challenge-332/sgreen/python/ch-2.py | 27 |
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() |
