Letters can be used to compose some beautiful graphics. An example is given below: ABCDEFG BABCDEF CBABCDE DCBABCD EDCBABC This is a graphic with 5 rows and 7 columns. Please find out the pattern of this graphic and output one

n,m=(int(i) for i in input().split())
list=[]
for i in range(n):
    list.append([])
    a=0
    for j in range(m):
        if i-j>0:
            list[i].append(chr(65-j+i))
        else:
            list[i].append(chr(65+a))
            a=a+1
for i in range(n):
    for j in range(m):
        print(list[i][j],end='')
    print()

Guess you like

Origin blog.csdn.net/jiahuiandxuehui/article/details/115208176