Python code for printing the string without vowels using list comprehension

0 votes
I have the python code for taking a string as the input and printing it after removing the vowels. How do I achieve the same using list comprehension? Thank you
Jul 8, 2019 in Python by Anvit
6,324 views

1 answer to this question.

0 votes

Hey @Anvit, you can use something like this:

def without_vowels(sentence):
    vowels = 'aeiou'
    print (''.join([ l for l in sentence if l not in vowels]))

if __name__ == '__main__':
    n = raw_input("Enter a sentance")
    without_vowels(n)
answered Jul 8, 2019 by Rajeev

Related Questions In Python

+1 vote
1 answer
0 votes
0 answers
0 votes
1 answer

Write code to create a list of word lengths for the words in original_str using the accumulation pattern and assign the answer to a variable num_words_list.

Hi,  num_words_list = len(original_str.split()) original_str.split() - split words in ...READ MORE

answered May 27, 2020 in Python by Niroj
• 82,880 points
3,518 views
0 votes
1 answer

Normal Python code equivalent to given list comprehension

You can try this code list1=[] for i in ...READ MORE

answered Jun 8, 2018 in Python by jain12
• 170 points
569 views
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,411 views
0 votes
1 answer

Removing surrounding whitespace

Try the strip() function:  s = s.strip() If you ...READ MORE

answered May 4, 2018 in Python by Nietzsche's daemon
• 4,260 points
568 views
–1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP