# Ryan Martin
# macid: abcd123
# student number: #######
# August 8, 2011
#
# This is a solution for Marked Assignment 3 (Lab 07) on Wednesday.

def makeRow(w, m, c):
    '''Returns a string of a histogram row of length w and max length m made of c.'''
    
    line = c * w + ' ' * (m - w)
    return line

def histogram(a, c):
    '''Returns a list of lines that form a histogram by applying FofX to the list of integers a, using the pattern p.'''
    maxVal = max(a)
    
    result = []
    for i in range(len(a)):
        result.append(makeRow(a[i],maxVal,c))

    return result

def flipHist(histogram):
    '''Returns the horizontally flipped version of histogram'''

    result = []
    for row in histogram:
        rowList = list(row)
        rowList.reverse()

        flipped = ''.join(rowList)
        result.append(flipped)

    return result
    
'''
Design Question

For w, the histogram function should use
each value of a. For m, the histogram function should use
the maximum value of all values in a.
The m value is important to keep everything
lined up when flipping the histogram.

Testing Report

Test: 1 for function makeRow
Input: [(5, 8, '@')]
Expected Output: ['@@@@@   ']
Actual Output: ['@@@@@   ']
Result: pass

Test: 1 for function histogram
Input: [([1, 3, 4, 2], '*')]
Expected Output: [['*   ', '*** ', '****', '**  ']]
Actual Output: [['*   ', '*** ', '****', '**  ']]
Result:pass

Test: 1 for function flipHist
Input: [['*   ', '*** ', '****', '**  ']]
Expected Output: [['   *', ' ***', '****', '  **']]
Actual Output: [['   *', ' ***', '****', '  **']]
Result:
'''