Computer Science
Write a program which replaces all vowels in the string with '*'.
Python
Python String Manipulation
73 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
33 Likes
Related Questions
Given a string S, write expressions to print
- first five characters of S
- Ninth character of S
- reversed S
- alternate characters from reversed S
Write a program to count the number of times a character occurs in the given string.
Write a program which reverses a string and stores the reversed string in a new string.
Write a program that prompts for a phone number of 10 digits and two dashes, with dashes after the area code and the next three numbers. For example, 017-555-1212 is a legal input. Display if the phone number entered is valid format or not and display if the phone number is valid or not (i.e., contains just the digits and dash at specific places.)