From 2f9ac991c97bb4de0a76c631290a194c6377d241 Mon Sep 17 00:00:00 2001 From: Simon Green Date: Sun, 20 Apr 2025 14:56:31 +1000 Subject: sgreen solutions to challenge 317 --- challenge-317/sgreen/python/ch-1.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 challenge-317/sgreen/python/ch-1.py (limited to 'challenge-317/sgreen/python/ch-1.py') diff --git a/challenge-317/sgreen/python/ch-1.py b/challenge-317/sgreen/python/ch-1.py new file mode 100755 index 0000000000..3300ed4a9d --- /dev/null +++ b/challenge-317/sgreen/python/ch-1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import sys + + +def is_acronyms(array: list, word: str) -> bool: + # Make up the acronym for the first letter in each word + acronym = ''.join(s[0] for s in array) + + # Compare it to the supplied string + return acronym.lower() == word.lower() + + +def main(): + # The last string is the word (acronym) + result = is_acronyms(sys.argv[1:-1], sys.argv[-1]) + print(result) + + +if __name__ == '__main__': + main() -- cgit