Help me, give hints, not full answers please. | Sololearn: Learn to code for FREE!


Help me, give hints, not full answers please.

Given a word as input, output a list, containing only the letters of the word that are not vowels. The vowels are a, e, i, o, u. Sample Input awesome Sample Output ['w', 's', 'm'] Use a list comprehension to create the required list of letters and output it.

11/30/2021 11:59:57 AM


12 Answers

New Answer


1. Take the input string 2. Make a variable for vowels 3. Make a list comprehension of the input when it is not a vowel 4. Print the list


One way to approach this could be: * split input word to a list of characters * create an empty list for the output * iterate over the input list: check for each character, if it is a vowel, if yes, then append it to the output list * print output list after the loop


Quarkom , you are just trying to solve the task from the tutorial "intermediate python". this tutorial requires some basic knowledge of "python for beginners" or "python core". to solve the task you need to know how toe use loops (for loop), lists and list comprehensions. if you are not familiar with this items, you should go an other learning path to get the basics, and then later come back to solve the exercise. happy coding and good success!


Lisa , just to mention, that we don't need to spilt the input to individual characters, since we can iterate directly on a string.


list comprehension looks something like this a = [i for i in range (b)] 2. You need a if statement to check if the value is there or not using the in keyword and not.


w= input() vowel = ['a','e','i','o','u'] x=[i for i in w if i not in vowel] print(x)


Lothar Yes, you're right! I'm not sure if the question had been edited since I wrote my comment or if I missed something – but when I answered it, I read it as a beginner's question and wanted my approach to be very explicit about the steps.


Thank you I solved it


Lothar Ye, I did python for begginers but not python core, I will move to python core then to understand things better


Quarkom Yeah, that's it, you can also use one string for the vowels instead "aeiou". #oneliner print([x for x in input() if x not in "aeiou"])


Mafdi oh nice


I have no idea how to solve this one...