python_days5_绘制不同颜色的多个同心圆绘制棋盘

画多个同心圆

import turtle

my_colors=('red','green','yellow','blue','black')
t=turtle.Pen()
for i in range(5):
    t.penup()
    t.goto(0,-i*10)
    t.pendown()
    t.color(my_colors[i%len(my_colors)])
    t.circle(15+i*10)
'''t.goto(0,0)
t.circle(100)
t.goto(0,-100)
t.circle(200)
t.goto(0,-200)
t.circle(300)'''
turtle.done()#程序执行完,窗口仍然在

在这里插入图片描述

画棋盘

import turtle
t=turtle.Pen()
temp=input('输入你想画的X*X的棋盘')
X=int (temp)
#X=4
for i in range(X+1):
    t.penup()
    t.goto(0,i*10)
    t.pendown()
    t.goto(X*10,i*10 )
for i in range(X+1):
    t.penup()
    t.goto(i*10,0)
    t.pendown()
    t.goto(i*10, X*10)
turtle.done()#程序执行完,窗口仍然在'''
发布了22 篇原创文章 · 获赞 1 · 访问量 462

猜你喜欢

转载自blog.csdn.net/ws297933371/article/details/105600350