Answer to Question #231607 in Python for kaavya

Question #231607

Remove Vowels in a Sentence

You are given a sentence. Write a program to remove all the vowels in the given sentence.

Note: Sentence has both lowercase and uppercase letters.Input

The first line of input is a string N.

Explanation

In the example given a sentence

Hello World, the sentence contains vowels e, o.

So, the output should be

Hll Wrld.

Sample Input 1

Hello World

Sample Output 1

Hll Wrld

Sample Input 2

Once upon a time

Sample Output 2

nc pn tm




1
Expert's answer
2021-08-31T05:58:52-0400
string = input("Enter any string: ")
if string == 'x':
    exit();
else:
    newstr = string;
   
    vowels = ('a', 'e', 'i', 'o', 'u');
    for x in string.lower():
        if x in vowels:
            newstr = newstr.replace(x,"");
    
    print(newstr);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS