数字三角形

思路:

step1:i >= j时打印j,以空格隔开;

代码如下:

while True:
    try:
        n = int(input())
        i = 1
        while i <= n:
            j = 1
            while j <= n:
                if i >= j:
                    print(j,end=' ')
                else:
                    print('  ',end='')
                j += 1
            print()
            i += 1
    except:
        break