Skip to content

Instantly share code, notes, and snippets.

@beauvais
Created January 20, 2013 20:06
Show Gist options
  • Select an option

  • Save beauvais/4581317 to your computer and use it in GitHub Desktop.

Select an option

Save beauvais/4581317 to your computer and use it in GitHub Desktop.
anti_vowel for code academy
def anti_vowel(text):
vowels = ["A", "a", "E", "e", "I", "i", "O", "o", "U", "u"]
anti = []
for i in text:
if i in vowels:
pass
else:
anti.append(i)
return "".join(anti)
print anti_vowel("and i Like apricots")
@SinaKarimi7
Copy link
Copy Markdown

SinaKarimi7 commented Jun 8, 2016

This code is worked, too

def anti_vowel(text):
vowels = ["a", "e", "u", "i", "o", "A", "E", "U", "I", "O"]
antivowel = ""
for i in range(len(text)):
if text[i] not in vowels:
antivowel += text[i]
return antivowel

@snipeo
Copy link
Copy Markdown

snipeo commented Dec 2, 2016

Another way ^^
def anti_vowel(text):
without_vowel = str()
vowel = "aeiouAEIOU"
for i in text:
if i not in vowel:
without_vowel += i
return without_vowel

@alifouad991
Copy link
Copy Markdown

Very nice guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment