aboutsummaryrefslogtreecommitdiff
path: root/challenge-274/zapwai/python/ch-1.py
diff options
context:
space:
mode:
authorDavid Ferrone <zapwai@gmail.com>2024-06-20 16:42:41 -0400
committerDavid Ferrone <zapwai@gmail.com>2024-06-20 16:42:41 -0400
commit8ef5ca339458a84020cb28e58aed50e18720b40b (patch)
tree78c44541e20ad6c645f3ce4e01369c6b311b70ce /challenge-274/zapwai/python/ch-1.py
parentffc47a8850ee877978e371d11a01a028862a3f9d (diff)
downloadperlweeklychallenge-club-8ef5ca339458a84020cb28e58aed50e18720b40b.tar.gz
perlweeklychallenge-club-8ef5ca339458a84020cb28e58aed50e18720b40b.tar.bz2
perlweeklychallenge-club-8ef5ca339458a84020cb28e58aed50e18720b40b.zip
Week 274
Diffstat (limited to 'challenge-274/zapwai/python/ch-1.py')
-rw-r--r--challenge-274/zapwai/python/ch-1.py30
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)
+