From 6dad2b4f822afe167c59329b2493635db6809a2b Mon Sep 17 00:00:00 2001 From: David Ferrone Date: Mon, 22 Jul 2024 10:39:22 -0400 Subject: Week 279 --- challenge-279/zapwai/python/ch-2.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 challenge-279/zapwai/python/ch-2.py (limited to 'challenge-279/zapwai/python/ch-2.py') diff --git a/challenge-279/zapwai/python/ch-2.py b/challenge-279/zapwai/python/ch-2.py new file mode 100644 index 0000000000..b8b25daeeb --- /dev/null +++ b/challenge-279/zapwai/python/ch-2.py @@ -0,0 +1,24 @@ +def is_vowel(c): + if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u': + return True + return False + +def proc(mystr): + print("Input: mystr =", mystr) + cnt = 0 + for c in list(mystr): + if is_vowel(c): + cnt += 1 + + if cnt % 2 == 0: + print("Output: true") + else: + print("Output: false") + +mystr = "perl" +proc(mystr) +mystr = "book" +proc(mystr) +mystr = "goodmorning" +proc(mystr) + -- cgit