U E D R , A S I H C RSS

마름모출력/문보창

No older revisions available

No older revisions available



마름모 출력

~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)
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:24
Processing time 0.0176 sec