Alphabet Rangoli

  • + 0 comments
    def print_rangoli(size):
        y = [chr(97+i) for i in range(26)]
        inp = size
        for i in range(2*inp-1):
            temp = [y[abs(inp - 1 - i) + abs(inp - 1 - j)] if (abs(inp - 1 - j) + abs(inp - 1 - i))<= (inp - 1) else  '-' for j in range(2*inp-1)]
            print('-'.join(temp))
    
    if __name__ == '__main__':
        n = int(input())
        print_rangoli(n)