8 anti_vowel. Nice and easy solution:


def anti_vowel(text):
x = ""
for char in text:
if char not in "aeiouAEIOU":
x = x + char
return x

           Just make sure to put it at the right indentation.

          If you have any suggestion please feel free to share.


def scrabble_score(word):
    x = 0
    for char in word: 
        x = x + score[char.lower()]
    return x

The answer to 9. Scrabble_score with the same idea


Nice! I took a super cheater route! I did the following:
def anti_vowel(text):
text = text.replace("a")
text = text.replace("e")
text = text.replace("i")
text = text.replace("o")
text = text.replace("u")
text = text.replace("A")
text = text.replace("E")
text = text.replace("I")
text = text.replace("O")
text = text.replace("U")
return text

Obviously your answer is what the designers of the problem were looking for.


def anti_vowel(x):
new_str = " "
led = 0

for i in x:  
    for j in "aeiouAEIOU":
        if i == j:
           led = 1
            led = 0
        led += led        
    if led <1:
        new_str += i           
return new_str

print anti_vowel("Hey look Words!")

This prog really works, but mentor does'n accept it.
Youry? UKR


You should make change!
def anti_vowel(text):
text = text.replace("a","")
text = text.replace("e","")
text = text.replace("i","")
text = text.replace("o","")
text = text.replace("u","")
text = text.replace("A","")
text = text.replace("E","")
text = text.replace("I","")
text = text.replace("O","")
text = text.replace("U","")
return text

def anti_vowel(text):
    vowels = 'aeiouAEIOU'
    for letter in text:
        for vowel in vowels:
            if vowel == letter:
                letter = ""
    return text

That's the code I wrote but it's not working. That's not a solution but since this is the only anti_vowel thread I am posting here. Help please!


@odrekci: Thing is that if the if statement is false, you should've added that character to the new string so it could be returned. Try making it different by checking if:

 vowel != letter

There you could use a new variable, suppose is new_String, and concatenate that character, who's not a vowel, to the new string to be returned.

Quote me if there's anything else I can help you with!

Best regards,

Edit: Also, another error will occur! Not only the if statement but the fact that is the condition is changed to *different even if you get the character who isn't a vowel and concatenating into the new string, you'll do that multiple times, each time per vowel.
So if the set is 'aeiouAEIOU' and the value in letter is C, you'll store C ten times, because that's the quantity of elements in the vowel set you're using, due to the fact that letter is not a vowel.
Such approach might not work, unless you change your idea.


I saw that and I will probably do it in a diffrent way but can you tell me why my first code didn't work?
Was it because of the
letter = ""
If so, why exactly?


@odrekci: I did edit my previous post so I'd ask you to take a look!
That approach might not work because even if it's a vowel or not, the value in the letter variable will continue the same and continue to be compared and executed for each element in the vowel set.
It would be possible to use two for loops in case the text was a list but this way you would still need to check each character.
The way you did doesn't seem to really work, sorry to say that.


def anti_vowel(text):
for c in text:
if c in "aeiouAEIOU":
return text


I've did that.

def anti_vowel(text):
c = "aeiouAEIOU"
result = ""
for i in range(len(text)):
if text[i] in c:
i =""
result += text[i]
return result