aboutsummaryrefslogtreecommitdiff
path: root/challenge-280/zapwai/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-280/zapwai/python/ch-2.py')
-rw-r--r--challenge-280/zapwai/python/ch-2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-280/zapwai/python/ch-2.py b/challenge-280/zapwai/python/ch-2.py
new file mode 100644
index 0000000000..615cd89919
--- /dev/null
+++ b/challenge-280/zapwai/python/ch-2.py
@@ -0,0 +1,17 @@
+def proc(mystr):
+ print("Input:", mystr)
+ cnt = 0
+ words = mystr.split('|')
+ for i in range(len(words)):
+ if i % 2 == 0:
+ for l in list(words[i]):
+ if l == "*":
+ cnt += 1
+ print("Output:", cnt)
+mystr = "p|*e*rl|w**e|*ekly|"
+proc(mystr)
+mystr = "perl"
+proc(mystr)
+mystr = "th|ewe|e**|k|l***ych|alleng|e"
+proc(mystr)
+