Python Remove Vowels in String Program

By | June 11, 2021

Python Remove Vowels in String Program – This Python program will take an input string from user. It will remove any vowels in this string and will display the output string after removing vowels in that input string.

Remove Vpwels From Input String Python Programming

We will use:

  1. input() function to display message and get the input string from the user.
  2. We will crate a list containing all vowels in small case and upper case:     vowel_list = [‘a’, ‘e’, ‘i’, ‘o’, ‘u’, ‘A’, ‘E’, ‘I’, ‘O’, ‘U’]
  3. Define a new variable output_string that will store the result of this Python program that is, the string without vowels.
  4. Find length of the input_string.
  5. Use a for loop from 0 to n-1 where n represents the size of length of the string.
  6. In this coding, we will check if any vowel is present in the input string it will not be moved to output string whereas all other characters will be shifted.
  7. Using print() function to output the output string.

Python Remove Vowels in String Program

# ~~~* *~~~

# Program to remove vowels from a string

input_string = input("Enter String To Cont Vowels:")

vowel_list = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
output_string = ""

str_length = len(input_string)

for i in range(str_length):
    if input_string[i] not in vowel_list:
        output_string = output_string + input_string[i]

               "Output String Without Vowels is: ")



Leave a Reply

Your email address will not be published. Required fields are marked *