aboutsummaryrefslogtreecommitdiff
path: root/challenge-254/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-01-31 13:40:24 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-01-31 13:40:24 +0000
commita2f0218d62b74adbb34a0330c25f9f4efaa50bd4 (patch)
tree29a5194200892fb00828fcb323706be10fb73516 /challenge-254/eric-cheung/python/ch-2.py
parenta52561b3a2f2989033faea3c0948020a10720dbb (diff)
downloadperlweeklychallenge-club-a2f0218d62b74adbb34a0330c25f9f4efaa50bd4.tar.gz
perlweeklychallenge-club-a2f0218d62b74adbb34a0330c25f9f4efaa50bd4.tar.bz2
perlweeklychallenge-club-a2f0218d62b74adbb34a0330c25f9f4efaa50bd4.zip
- Added solutions by Ulrich Rieke.
- Added solutions by Eric Cheung. - Added solutions by Laurent Rosenfeld. - Added solutions by E. Choroba. - Added solutions by Niels van Dijke. - Added solutions by Luca Ferrari. - Added solutions by Mark Anderson. - Added solutions by Stephen G Lynn. - Added solutions by Peter Meszaros. - Added solutions by Thomas Kohler. - Added solutions by W. Luis Mochan. - Added solutions by David Ferrone. - Added solutions by Steven Wilson. - Added solutions by Dave Jacoby. - Added solutions by Robbie Hatley. - Added solutions by Peter Campbell Smith. - Added solutions by Arne Sommer. - Added solutions by PokGoPun. - Added solutions by Roger Bell_West.
Diffstat (limited to 'challenge-254/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-254/eric-cheung/python/ch-2.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-254/eric-cheung/python/ch-2.py b/challenge-254/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..e1a9c3c14f
--- /dev/null
+++ b/challenge-254/eric-cheung/python/ch-2.py
@@ -0,0 +1,24 @@
+
+## Reference
+## https://www.w3resource.com/python-exercises/basic/python-basic-1-exercise-71.php
+## https://www.geeksforgeeks.org/reverse-vowels-given-string/
+
+## strInput = "Raku" ## Example 1
+## strInput = "Perl" ## Example 2
+## strInput = "Julia" ## Example 3
+strInput = "Uiua" ## Example 4
+
+arrVowel = [charLoop for charLoop in strInput.lower() if charLoop in ["a", "e", "i", "o", "u"]]
+
+strOutput = ""
+
+for nIndx, charLoop in enumerate(strInput.lower()):
+ if charLoop in ["a", "e", "i", "o", "u"]:
+ strOutput = strOutput + arrVowel[-1]
+ del arrVowel[-1]
+ else:
+ strOutput = strOutput + charLoop
+
+strOutput = strOutput.title()
+
+print (strOutput)