diff options
| author | Packy Anderson <PackyAnderson@gmail.com> | 2023-10-30 21:46:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-30 21:46:01 -0400 |
| commit | 2a34bfaf2ba34539535040875128b7e5148f9d47 (patch) | |
| tree | 1d5f0bf94979c72111f3d96c8b00e19bbf20ff85 /challenge-240/sgreen/python | |
| parent | 1b80709ac09ecd2d9fc73b50cb2015f3c958bd0d (diff) | |
| parent | 71ad4139989a590a4a64b128ae3de74f7c19bad8 (diff) | |
| download | perlweeklychallenge-club-2a34bfaf2ba34539535040875128b7e5148f9d47.tar.gz perlweeklychallenge-club-2a34bfaf2ba34539535040875128b7e5148f9d47.tar.bz2 perlweeklychallenge-club-2a34bfaf2ba34539535040875128b7e5148f9d47.zip | |
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-240/sgreen/python')
| -rwxr-xr-x | challenge-240/sgreen/python/ch-1.py | 15 | ||||
| -rwxr-xr-x | challenge-240/sgreen/python/ch-2.py | 13 |
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-240/sgreen/python/ch-1.py b/challenge-240/sgreen/python/ch-1.py new file mode 100755 index 0000000000..7f4a6e8caa --- /dev/null +++ b/challenge-240/sgreen/python/ch-1.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys + + +def main(words, acronym): + # Calculate the first letters from the words + first_letters = ''.join(map(lambda w: w[0], words)) + print('true' if first_letters.lower() == acronym.lower() else 'false') + + +if __name__ == '__main__': + # The last value is the 'acronym' + acronym = sys.argv.pop() + main(sys.argv[1:], acronym) diff --git a/challenge-240/sgreen/python/ch-2.py b/challenge-240/sgreen/python/ch-2.py new file mode 100755 index 0000000000..fcd7d98d06 --- /dev/null +++ b/challenge-240/sgreen/python/ch-2.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + + +def main(ints): + solution = [ ints[ints[i]] for i in range(len(ints))] + print(*solution, sep=', ') + +if __name__ == '__main__': + # Convert input into integers + array = [int(n) for n in sys.argv[1:]] + main(array) |
