Computer Science, asked by singhcomankit07, 2 months ago

Write a program with a user defined program with string as a parameter which replaces all
vowels in the string with "*"​

Attachments:

Answers

Answered by santdas36
0

vowels = ['a','e','i','o','u']

def replaceVowels(str):

str = list(str)

replacedStr = map(lambda x: '*' if x in vowels else x, str)

print(''.join(replacedStr))

inp = input('Enter string: ')

replaceVowels(inp)

Answered by Equestriadash
9

The following co‎des have been written using Python.

#defining a function

def vowel_replace(string):

   #starting a loop to traverse through the characters

   for i in string:

       #checking for the required characters

       if i in "aeiouAEIOU":

           #replacing the required characters with an asterisk

           string = string.replace(i, "*")

   #printing the final output

   print(string)

#obtaining input from a user

string = input("Enter a string: ")

#calling the function on the input

vowel_replace(string)

Similar questions