diff options
| author | irifkin <ianrifkin@ianrifkin.com> | 2023-10-28 17:53:30 -0400 |
|---|---|---|
| committer | irifkin <ianrifkin@ianrifkin.com> | 2023-10-28 17:53:30 -0400 |
| commit | 5d10a6e13bb7823cc671eec3bd682cef6bed5ef7 (patch) | |
| tree | ab09b937040c61dd44773fe35b32f9265bd00cdd /challenge-240/ianrifkin/python/ch-1.py | |
| parent | 67310476fd1daa9d74365ca666f4f6d9a0932d50 (diff) | |
| download | perlweeklychallenge-club-5d10a6e13bb7823cc671eec3bd682cef6bed5ef7.tar.gz perlweeklychallenge-club-5d10a6e13bb7823cc671eec3bd682cef6bed5ef7.tar.bz2 perlweeklychallenge-club-5d10a6e13bb7823cc671eec3bd682cef6bed5ef7.zip | |
solutions in perl, python, and raku. and a README of a blog post.
Diffstat (limited to 'challenge-240/ianrifkin/python/ch-1.py')
| -rw-r--r-- | challenge-240/ianrifkin/python/ch-1.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-240/ianrifkin/python/ch-1.py b/challenge-240/ianrifkin/python/ch-1.py new file mode 100644 index 0000000000..a7e88fddd5 --- /dev/null +++ b/challenge-240/ianrifkin/python/ch-1.py @@ -0,0 +1,27 @@ +#!/usr/local/bin/python3 + +# You are given an array of strings and a check string. +# Write a script to find out if the check string is the acronym of the words in the given array. + +def check_acronym (acronym, words): + real_acronym = '' + for word in words: + real_acronym += word[0] + print(acronym.upper() == real_acronym.upper()) + +# Example 1 +words = ("Perl", "Python", "Pascal") +acronym = "ppp" +check_acronym(acronym, words) + +# Example 2 +words = ("Perl", "Raku") +acronym = "rp" +check_acronym(acronym, words) + +# Example 3 +words = ("Oracle", "Awk", "C") +acronym = "oac" +check_acronym(acronym, words) + + |
