Computer Science

Write a program which replaces all vowels in the string with '*'.

Python

Python String Manipulation

64 Likes

Answer

str = input("Enter the string: ")
newStr = ""
for ch in str : 
    lch = ch.lower()
    if lch == 'a' \
       or lch == 'e' \
       or lch == 'i' \
       or lch == 'o' \
       or lch == 'u' :
        newStr += '*'
    else :
        newStr += ch
print(newStr)

Output

Enter the string: Computer Studies
C*mp*t*r St*d**s

Answered By

28 Likes


Related Questions