def ruler(t):
    m = 2**(t-1) + 1
    lst = [''] * m
    lst[0] = lst[m - 1] = '-' * t

    def rec(a, b, s):
        m = (a + b) // 2
        lst[m] = '-' * (s - 1)
        if s > 2:
            rec(a, m, s - 1)
            rec(m, b, s - 1)
    rec(0, m - 1, t)
    return lst

r = ruler(5)
print(r)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: