+ 2

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.

30th Nov 2021, 11:59 AM
Quarkom
12 Respuestas
+ 5
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
30th Nov 2021, 12:58 PM
Mafdi
Mafdi - avatar
+ 7
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
30th Nov 2021, 12:48 PM
Lisa
Lisa - avatar
+ 6
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!
30th Nov 2021, 4:32 PM
Lothar
Lothar - avatar
+ 6
Lisa , just to mention, that we don't need to spilt the input to individual characters, since we can iterate directly on a string.
3rd Dec 2021, 9:21 AM
Lothar
Lothar - avatar
+ 5
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.
30th Nov 2021, 12:46 PM
MATOVU CALEB
MATOVU CALEB - avatar
+ 3
w= input() vowel = ['a','e','i','o','u'] x=[i for i in w if i not in vowel] print(x)
3rd Dec 2021, 9:28 AM
Quarkom
+ 2
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.
3rd Dec 2021, 9:26 AM
Lisa
Lisa - avatar
+ 1
Thank you I solved it
30th Nov 2021, 6:03 PM
Quarkom
+ 1
Lothar Ye, I did python for begginers but not python core, I will move to python core then to understand things better
3rd Dec 2021, 8:59 AM
Quarkom
+ 1
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"])
3rd Dec 2021, 4:38 PM
Mafdi
Mafdi - avatar
+ 1
Mafdi oh nice
7th Dec 2021, 10:10 AM
Quarkom
0
I have no idea how to solve this one...
30th Nov 2021, 12:00 PM
Quarkom