haradashinya
6/12/2013 - 6:41 AM

test.py

# triangle part 1

def triangle(n):
    s = ''
    for w in range(n+1):
        for h in range(w):
            s += '#'
            if h == w -1:
                s += '\n'
    return s

# triangle part 2

def triangle(n):
    s = ''
    for i in range(1,n+1):
        s += (n - i) * '#'
        s += '\n'
    return s


# triangle part 3.
def triangle(n):
    s = ''
    mid = n/2
    for i in range(0,n+1):
        row =  (n - i)
        s +=   (abs(abs(row - 5) - 5) * '#') + '\n'
    return s