'''
Created on Sep 20, 2011

@author: rodger
'''
# finished this one
def is_vowel0(ch):
    if ch == 'a':
        return True
    if ch == 'e':
        return True
    if ch == 'i':
        return True
    if ch == 'o':
        return True
    if ch == 'u':
        return True
    else:
        return False
        
        
  
def is_vowel(ch):
    if ch == 'a' or ch == 'e' or ch == 'i' \
    or ch == 'o' or ch == 'u':
        return True 
    return False


def is_vowel2(ch):
    c = "aeiou".count(ch)
    if c>0:
        return True
    else:
        return False
    
def is_vowel3(ch):
    return "aeiou".count(ch)>0

'''
print is_vowel("i")
print is_vowel("x")
print is_vowel0("i")
print is_vowel0("x")
print is_vowel2("i")
print is_vowel2("x")
print is_vowel3("i")
print is_vowel3("x")
'''


def vowelsOnly1(word):
    '''
    returns a string of only the vowels from word
    '''
    answer=''
    for bogus in word:
        if is_vowel(bogus):
            answer = answer + bogus
    return answer        
  
 
def vowelsOnly(word):
    '''
    returns a string of only the vowels from word
    if we replace True with False below, it returns consonants
    '''
    answer=''
    for ch in word:
        if is_vowel(ch) == True:
            answer = answer + ch
    return answer       

def allvowels(word):
    '''
    returns True if the word is ALL vowels
    returns False otherwise
    '''
    answer = ''
    for ch in word:
        if is_vowel(ch):
            answer = answer + ch
        if len(word) == len(answer): 
            return True
    return False
         

def allvowels2bad(word):
    '''
    returns True if the word is ALL vowels
    returns False otherwise
    Doesn't work, it only looks at the first charcacter and
    returns true or false and is gone.
    '''
    for letter in word:
        if is_vowel(letter) == False:   # if not is_vowel(letter):
            return False
            break
        else: 
            return True
 
def allvowels2(word):
    '''
    returns True if the word is ALL vowels
    returns False otherwise
    Doesn't work, it only looks at the first charcacter and
    returns true or false and is gone.
    '''
    for letter in word:
        if is_vowel(letter) == False:   # if not is_vowel(letter):
            return False
            break  #total useless will never execute this line
    return True  # at this point I know they are all vowels    
    

print "Test vowelsOnly"
print vowelsOnly("computer science")      
print vowelsOnly1("hello")

print "Test allvowels"    
print allvowels("ooooeeeeeiiii") 
print allvowels("owaowaaa")      

print "Test allvowels2"    
print allvowels2("ooooeeeeeiiii") 
print allvowels2("owaowaaa")
   
def transform(word): 
    '''
    process one word and return it
    '''
    if allvowels(word):
        return word
    # has at least one consonant
    
   
def vowelsONlyBad(word):  #only looks at the first character
    answer = ''
    for ch in word:
        if ch=='a' or ch == 'e' or ch == 'i'  or ch == 'o'  or ch == 'u':
            return True
        else:
            return False
        answer = answer + ch
    return answer 
        
        