diff options
Diffstat (limited to 'challenge-274/zapwai/python/ch-1.py')
| -rw-r--r-- | challenge-274/zapwai/python/ch-1.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-274/zapwai/python/ch-1.py b/challenge-274/zapwai/python/ch-1.py new file mode 100644 index 0000000000..b1dcb7a1d2 --- /dev/null +++ b/challenge-274/zapwai/python/ch-1.py @@ -0,0 +1,30 @@ +def is_vowel(c): + return c.lower() in 'aeiou' + +def proc(sent): + print("Input: ", sent) + print("Output: ", end='') + words = sent.split(" "); + for i in range(len(words)): + A = "" + for j in range(i+1): + A += "a" + lets = list(words[i]) + first_let = lets[0] + reword = "" + for k in range(1,len(lets)): + reword += lets[k] + reword += first_let + if is_vowel(first_let): + print(words[i]+"ma"+A+" ", end='') + else: + print(reword+"ma"+A+" ", end='') + print() + +sent = "I love Perl" +proc(sent) +sent = "Perl and Raku are friends" +proc(sent) +sent = "The Weekly Challenge" +proc(sent) + |
