编写一个python程序 编写一个程序,输出由字符构成的田字格,如下图所示
# 定义田字格的大小
size = 5
# 输出田字格
for i in range(size):
for j in range(size):
if i == size//2 or j == size//2:
print("*", end=" ")
else:
print(" ", end=" ")
print()
输出结果:
* *
* *
* * * * *
* *
* *
原文地址: https://www.cveoy.top/t/topic/tzF 著作权归作者所有。请勿转载和采集!