This is a string handling question.
Build three string based on the question:
consonant = "bcdfghjklmnpqrstvwxyz" closestVowel = "aaeeeiiiiooooouuuuuuu" nextConsonant = "cdfghjklmnpqrstvwxyzz"
if char x in input string,
i = index of x in consonant.
newword = newword + x
if i > -1, mean find x in consonant, then
newword = newword +closestVowel[i] + nextConsonant[i]
Please look at the code:
consonant = "bcdfghjklmnpqrstvwxyz"
closestVowel = "aaeeeiiiiooooouuuuuuu"
nextConsonant = "cdfghjklmnpqrstvwxyzz"
word = input()
newword = ""
for x in word:
j = consonant.find(x)
newword += x
if j > -1:
newword = newword + closestVowel[j] + nextConsonant[j]
print(newword)
Comments