1.

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

Answer» ONG>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)



Discussion

No Comment Found