In the program given below, we have discussed how to remove the vowels present in a string and return the string without any vowel present in it. Â
For example:
Let us consider the string s=”Hi, I want to go to Beverly Hills for a vacation”
The compiler will remove all the vowels from the string ‘s’ and return the string.
Output:
H, wnt t g t Bvrly Hlls fr vctn
Source Code:
string = input("Enter any string: ")
if string == 'x':
 exit();
else:
 newstr = string;
 print("\nRemoving vowels from the given string");
 vowels = ('a', 'e', 'i', 'o', 'u');
 for x in string.lower():
 if x in vowels:
 newstr = newstr.replace(x,"");
 print("New string after successfully removed all the vowels:");
 print(newstr);
Related Questions
- How do you add to a matrix in python?
- How do you make a vowel counter in Python?
- How do I remove punctuation from a list in Python?
- How do you transpose a matrix in python?
- How do you find the sum of a matrix in python?
- How do you count the number of vowels in a list in Python?
- How do I remove punctuation from a text file in Python?
- How do you transpose in Python?
- How do you remove special and punctuation characters in Python?
- How do you add two matrices in Python using Numpy?
- Is vowel function in Python?
- How do I remove special characters from a list in Python?
- How do you transpose amatrix using Numpy in Python?
Leave a Reply