################################ # 打印下面图形 # # + - - - - + - - - - + # | | | # | | | # | | | # | | | # + - - - - + - - - - + # | | | # | | | # | | | # | | | # + - - - - + - - - - + # ################################ def print_line(num,count): line = ‘‘ for j in range(count): line += ‘+ ‘ for i in range(num-2): line += ‘- ‘ line += ‘+‘ print line def print_vertical(num,count): for n in range(num-2): line = ‘‘ for j in range(count): line += ‘| ‘ for i in range(num-2): line += ‘ ‘ print line def print_panel(num,count): print_line(num,count-1) print_vertical(num,count) print_line(num,count-1) print_vertical(num,count) print_line(num,count-1) print_panel(6,3)
注: python 以缩进排版管理代码块
时间: 2024-11-04 06:01:15