Saturday, April 9, 2016

Consonants Remover in Python


A simple program that  I wrote using Python as my programming language that will ask the user to give a word or a sentence and then our program will remove the consonants in the given word or a sentence by the user.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

def my_program():
   print()
   print("REMOVE CONSONANTS PROGRAM")
   print()
   str = input("Enter a String : ")
   print()
   consonants = ['b', 'c', 'd', 'f', 'g',
                 'h','j','k','l','m','n',
                 'p','q','r','s','t','v',
                 'w','x','y','z']
   result = ''
   for letter in str.lower():
      if letter not in consonants:
       result += letter
   print("The result is " ,result.upper(),".")
   print("\n");
   repeat = input('Do you want to continue ? (Y/N) : ')

   if repeat.upper() == "N":
       print("\n")
       print("END OF PROGRAM")
       quit
   if repeat.upper() == "Y":
       my_program()

if __name__ == '__main__':
       my_program()





No comments:

Post a Comment