Q. Change above program to surround the vowels with parentheses instead of not showing them.


For input word is "nectarine", the output should be 'n(e)ct(a)r(i)n(e)'
For input word is "blueberry", the output should be 'bl(u)(e)b(e)rry'

Answer :-

Program :-
string = input ("Enter the word :- ")
newstring = ""
for i in string :
    if i in "AEIOUaeiou":
        newstring += '(' + i + ')'
    else:
        newstring += i
print (newstring)
Output :-

Enter the word :- nectarine
n(e)ct(a)r(i)n(e)
>>> 
Enter the word :- blueberry
bl(u)(e)b(e)rry
>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post