Python用print()函數輸出田字格示例代碼如下:
#!/usr/bin/envpython
#-*-coding:utf-8-*-
#Python用print()函數輸出田字格
row=''
foriinrange(1,12):
forjinrange(1,12):
ifiin(1,6,11):
ifjin(1,6,11):
row=row+'+'+''
else:
row=row+'--'+''
else:
ifjin(1,6,11):
row=row+'|'+''
else:
row=row+''+''
row=row+'\n'
printrow