'''
Created on Sep 12, 2010, modified on Sep 12, 2011

@author: ola, modified by rodger
'''

def uppify_list(words):
    """ 
    Return a new list, based on parameter list
    but in which each string of parameter list 
    is represented by an upper case equivalent
    """

    return [w.upper() for w in words]

def print_list(words):
    """
    print each element of words, a list, on a single line
    """
    for w in words:
        print w,
    print

def uppify_file(filename):
    """
    filename is name of a file, its contents are printed by
    converting each word to an uppercase equivalent
    and respecting lines, i.e., one line of output
    for each line of input. Whitespace is NOT 
    respected, i.e., white space separates line entries
    but isn't preserved in the output
    """
    file = open(filename)
    for line in file:
        words = line.split()         # words on one line
        uwords = uppify_list(words)  #upper case equivalent list
        print_list(uwords)
    file.close()

def main():
    filename = "../../../data/romeo.txt"
    uppify_file(filename)

if __name__ == "__main__":
    main()