From 5598c2ce58954b9fa56c460bb77a0e923c29a369 Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Mon, 22 Jul 2024 01:17:15 -0400 Subject: Challenge 279 solutions by Packy Anderson * Raku that maybe looks like Raku * Perl * Python that definitely looks like Perl * Elixir 1 Blog post --- challenge-279/packy-anderson/python/ch-2.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 challenge-279/packy-anderson/python/ch-2.py (limited to 'challenge-279/packy-anderson/python/ch-2.py') diff --git a/challenge-279/packy-anderson/python/ch-2.py b/challenge-279/packy-anderson/python/ch-2.py new file mode 100755 index 0000000000..b0614bba56 --- /dev/null +++ b/challenge-279/packy-anderson/python/ch-2.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +vowels = ['a', 'e', 'i', 'o', 'u'] + +def splitString(str): + return len([ + v for v in list(str.lower()) if v in vowels + ]) % 2 == 0 + +def solution(str): + print(f'Input: @str = "{str}"') + print(f'Output: {splitString(str)}') + +print('Example 1:') +solution("perl") + +print('\nExample 2:') +solution("book") + +print('\nExample 3:') +solution("good morning") -- cgit