From d58258463850d2949fe13a4097a83a5d17951548 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 5 Feb 2024 05:08:45 +0000 Subject: - Added template for week 255. --- challenge-255/luca-ferrari/python/ch-2.python | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 challenge-255/luca-ferrari/python/ch-2.python (limited to 'challenge-255/luca-ferrari/python/ch-2.python') diff --git a/challenge-255/luca-ferrari/python/ch-2.python b/challenge-255/luca-ferrari/python/ch-2.python new file mode 100644 index 0000000000..dc37e2ad93 --- /dev/null +++ b/challenge-255/luca-ferrari/python/ch-2.python @@ -0,0 +1,29 @@ +#!python + +# +# Perl Weekly Challenge 254 +# Task 2 +# +# See +# + +import sys + +# task implementation +# the return value will be printed +def task_2( args ): + word = args[ 0 ].lower() + vowels = list( reversed( list( filter( lambda x: x in ('a','e','i','o','u'), word ) ) ) ) + output = '' + for letter in word: + if letter not in ( 'a', 'e', 'i', 'o', 'u' ) or len( vowels ) == 0 + output += letter + else: + output += vowels.pop( 0 ) + + return output + + +# invoke the main without the command itself +if __name__ == '__main__': + print( task_2( sys.argv[ 1: ] ) ) -- cgit