diff options
Diffstat (limited to 'challenge-279/zapwai/python/ch-2.py')
| -rw-r--r-- | challenge-279/zapwai/python/ch-2.py | 24 |
1 files changed, 24 insertions, 0 deletions
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) + |
