def print_vertical(s):
    for char in s:
        print char + '\n'


def count(s, letter):
    '''Return the nubmer of times that the character, 
    represented by the string letter, occurs in the
    string s.'''
    
    num = 0
    for char in s:
        if char == letter:
            num = num + 1
    return num

def num_vowels(s):
    '''Return the number of vowels in str s.
    The letter "y" is not treated as a vowel.'''
    
    count = 0 # accumulator
    for c in s:
        if c in 'aAeEiIoOuU':
            count += 1 # count = count + 1
    return count

def reverse(s):
    '''Return a new str that is str s in reverse.'''
    
    rev = ''
    for char in s:
        rev = char + rev
    return rev
    
def remove_spaces(s):
    '''Return a new str that is the same as str s 
    but with any blanks removed.'''
    
    result = ''
    for char in s:
        if char != ' ':
            result = result + char # result += char
    return result

def count_matches(s1, s2):
    '''Return the number of characters in str s1 appear in str s2.'''
    
    pass

if __name__ == '__main__':
    
    print count('hello', 'l') # appears multiple times
    print count('hello', 'h') # appears once
    print count('hello', 'k') # does not appear
    
    print num_vowels('') # empty string
    print num_vowels('bhg') # no vowels
    print num_vowels('the') # one vowel
    print num_vowels('apple') # multiple vowels
    
    print reverse('') # empty string
    print reverse('a') # single character
    print reverse('hello') # multiple characters
    
    print remove_spaces('') # empty string
    print remove_spaces('this is my string') # with spaces
    print remove_spaces('hello') # without spaces