×
Reviews 4.9/5 Order Now

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

July 05, 2024
Prof. James Harper
Prof. James
🇦🇪 United Arab Emirates
Python
Prof. James Harper is an experienced software developer and educator with a Master's degree in Computer Science from the University of Melbourne. With over 900 completed assignments, he specializes in Python programming and application development. Prof. Harper's passion for teaching and extensive industry experience ensure that his solutions are not only functional but also well-documented and easy to understand.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Always start SQL assignments by understanding the schema and relationships between tables. Use proper indentation and aliases for clarity, and test queries incrementally to catch errors early.
News
Owl Scientific Computing 1.2: Updated on December 24, 2024, Owl is a numerical programming library for the OCaml language, offering advanced features for scientific computing.

Instructions

Objective

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() else: # 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)

Related Samples

Explore our curated collection of expertly solved Python assignment samples. Whether you're tackling basic syntax or complex data structures, our samples showcase comprehensive solutions crafted by Python programming experts. Gain insights and inspiration for your projects.