首页 > 其他 > 详细

画国际象棋盘

时间:2020-03-25 14:44:06      阅读:68      评论:0      收藏:0      [点我收藏+]
import turtle
for i in range(8): 
 for j in range(8):
  turtle.forward(37.5)
  if j % 2 == 0:
 
   if i % 2 ==0:
    turtle.begin_fill()
    for s in range(4):
     turtle.left(90)
     turtle.forward(37.5)
    turtle.end_fill()
   else :
    turtle.begin_fill()
    for s in range(4):
     turtle.right(90)
     turtle.forward(37.5)
    turtle.end_fill()
 if i % 2 == 0:
  turtle.left(90)
  turtle.forward(37.5)
  turtle.left(90)
 else:
  turtle.right(90)
  turtle.forward(37.5)
  turtle.right(90)
turtle.forward(300)
turtle.done()

 

画国际象棋盘

原文:https://www.cnblogs.com/670ling/p/12565867.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!