aboutsummaryrefslogtreecommitdiff
path: root/challenge-254/eric-cheung/python/ch-2.py
blob: e1a9c3c14f356e7544723d58d3e1706ea0c02c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)