~cpp 
if __name__ == '__main__':
    a=str(raw_input("패턴 입력: "))
    b=int(input("변의 길이 입력: "))

    l=[0]
    stack=[]
    for n in range(b*2-1):
        l.insert(n," ")
    l.insert(b-1,a)

    for m in range(b): 
        for n in range(b*2-1):
            print l[n],
        l[b-m-2]=a
        l[b+m]=a  
        print ""

    for m in range(b-1):
        
        l[m]=" "        
        l[b+b-2-m]=" "      
        for n in range(b*2-1):
            print l[n],        
        print ""
Retrieved from http://wiki.zeropage.org/wiki.php/마름모출력/김정현
last modified 2021-02-07 05:29:23