Created
August 11, 2014 01:11
-
-
Save christophergregory/cbdd9c986d15125b09f0 to your computer and use it in GitHub Desktop.
Function that returns list of vowels in string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getVowels(word, includeY=False, unique=False): | |
matches = [] | |
vowels = 'aeiou' if not includeY else 'aeiouy' | |
for char in word: | |
if char.lower() in vowels: | |
matches.append(char) | |
return list(set(matches)) if unique else matches | |
print getVowels('This is a fancy test string', includeY=True, unique=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment