×
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
Focus on understanding each phase of the compiler—lexical, syntax, semantic analysis, and code generation. Use clear diagrams or flowcharts to visualize the process, which helps in debugging and structuring your assignment effectively.
News
JetBrains Fleet 2.0: Offers AI-powered code completion, real-time collaboration, and cross-language support, providing a unified workspace ideal for modern development education.

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.