python绘制国际象棋棋盘核心代码
import turtle
step = 40
for i in range(8):
for j in range(8):
turtle.penup()
turtle.goto(i*step, j*step)
turtle.pendown()
turtle.begin_fill()
if (i+j)%2 == 0:
turtle.color("white")
else:
turtle.color("black")
for k in range(4):
turtle.forward(step)
turtle.right(90)
turtle.end_fill()
turtle.done()