+1 (315) 557-6473 

Create A Program to Print String After Removing Vowels in Python Assignment Solution.


Write a python assignment program to print string after removing vowels.

Requirements and Specifications

Program to print string after removing vowels in python language

Source Code

def process_string(s):


    Method for processing given string.

    Returns the same string with all the vowels removed and also capitalizes all the cononsnats

    :param s: input string

    :return: result of string processing


    # initializing result string with an empty string

    result = ''

    # iterating over all the characters of the given string

    for c in s:

        if c.isalpha():

            # if character is a letter, not skipping it only if it is not a vowel

            if c.lower() not in ['a', 'e', 'i', 'o', 'u']:

                # if letter is not a vowel (consonant) - adding uppercased letter to the result

                result += c.upper()


            # if character is not a letter, just keeping it in result string

            result += c

    # returning obtained result

    return result

if __name__ == '__main__':

    keep_asking = True

    while keep_asking:

        # prompting user to input a string

        s1 = input('Please, enter a string to process: ')

        # getting processed string

        s2 = process_string(s1)

        # outputting result

        print('Result:', s2)