Well, the reason why your code does not work so well is because of how
str.remove() works. I will not get into it because there are a couple of reason but it only takes out the lead most item that matches.
Moving on, how to actually build this in a way that works.
- First you have to iterate over your text.
- Second match if the iteration is in our vowel list/str
- Third only get the items that are not in the vowels
Sounds easy enough right?
Any time you have a problem you need to solve programmatically always write out the steps you need to complete in order to succeed. These are the same steps you will take when programming your problem. Make sense?
Let's get to it:
data = 'A string of random junk'
select_data = 
# Step One
for item in data:
# Step Two
if item.lower() not in 'aeiou': # This automagically iterates through our string.
# Step three
As you can see quickly I have all three steps necessary to complete this task programmed there. Nothing extra, this make it easier to read and understand, and that is why it is important to understand the steps you need to take in order to program your problem.
Having said all that, good luck, and any more questions feel free to ask.