1.

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

Answer»

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