Anti_vowel


#1



so glad it works :smiley:


def anti_vowel(text):
    t=""
    for c in text:
        for i in "aeiouAEIOU":
            if c==i:
                c=""
            else: c=c
        t=t+c
    print t
    return t    
anti_vowel("Hey You!")


#2

Oh..k

Why did you post this though?
It would be great if you delete this post for the sake of the people who are looking for straight foward answers. I believe, they should brainstorm as much as they can on their own, before they resort to the forums :slight_smile:

Thanks


#3

yea sure but if you're lost, on the west coast after 9pm and you'd like to understand. it helps me troubleshoot my own nonsense


#4

more simple a little bit:
def anti_vowel(text):
result = ""
for c in text:
if c in "aeiouAEIOU":
c = ""
else:
c = c
result += c
return result


#6

def anti_vowel(text):
     t = ""
     for c in text:
          if c.lower() not in "aeiouAEIOU":
              t += c
     return t

#7

You could even get rid of the upper case letters and just have:

def anti_vowel(text):
t = ""
for c in text:
if c.lower() not in "aeiou":
t += c
return t


#8

import re

def anti_vowel(text):
    new_word = []
    for char in text:
        if not re.match("(a|e|i|o|u)", char, re.IGNORECASE):
            new_word.append(char)
    return ''.join(new_word)

print anti_vowel("SuperCALIfrigis")

I used regex ^^


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.