################################ # 打印下面图形 # # + - - - - + - - - - + # | | | # | | | # | | | # | | | # + - - - - + - - - - + # | | | # | | | # | | | # | | | # + - - - - + - - - - + # ################################ 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 以缩进排版管理代码块
本文出自 “temp” 博客,转载请与作者联系!
原文:http://8318007.blog.51cto.com/8308007/1636528