我尝试打印此问题
输入
1
3
。
输出enter image description here
0
def repeat(c, n)
print(c * n)
def line():
print('+---+')
def box(row, col):
while row > 0:
line()
print('| |')
row = row -1
line()
n = int(input())
m = int(input())
box(n,m)
我想像我制作的行代码一样制作“列”
COLUMN = '| '
ROW = '+---'
def box(rows, cols):
columns = COLUMN * (cols + 1)
row = ROW * cols + '+'
box = []
for i in range(rows):
box.append(row)
box.append(columns)
box.append(row)
return '\n'.join(box)
if __name__=='__main__':
print(box(3,3))