Q. Write a program with a user-defined function with string as a parameter which replaces all vowels in the string with "*".
Answer =
def replaceVowels (st) :
newstr = ''
for character in st:
if character in 'aeiouAEIOU':
newstr += '*'
else:
newstr += character
return newstr
st = input ("Enter a String: ")
st1 = replaceVowels (st)
print ("The original String is:", st)
print ("The modified String is:", st1)
Output :-
Enter a String: Computer Portal
The original String is:- Computer Portal
The modified String is:- C*mp*t*r P*rt*l
>>>
Enter a String: PathWalla
The original String is:- PathWalla
The modified String is:- P*thW*ll*
>>>
OP BOLTE
ReplyDeleteThank you. : )
DeletePatta sa headshot opp
ReplyDelete: )
DeleteThank you,
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )