마름모 출력

~cpp 
def show_up_triangle(pattern, size):
    for i in range(size):
        print ' ' * (size - i),
        print pattern * (i * 2 + 1)
    return

def show_down_triangle(pattern, size):
    for i in range(size+1):
        print ' ' * i,
        print pattern * ((size-i) * 2 + 1)
    return

if __name__== '__main__':
    pattern = raw_input()
    size = input()
    show_up_triangle(pattern, size)
    show_down_triangle(pattern, size)
Retrieved from http://wiki.zeropage.org/wiki.php/마름모출력/문보창
last modified 2021-02-07 05:29:24