海龟绘图五环Python实现

效果展示,基础海龟语法: 

海龟绘图五环Python实现_第1张图片

 

import turtle  #导入海龟模块
turtle.showturtle()#显示箭头
turtle.write("hello,this is a beautiful world")
turtle.forward(300)#向前300像素
turtle.left(90)
turtle.forward(300)
turtle.goto(0,50)#去坐标0,50
turtle.goto(0,0)
turtle.penup()#抬起笔
turtle.goto(0,300)
turtle.pendown()#落下笔
turtle.circle(100)#半径为一百
turtle.done()#保持窗口存在

海龟绘图五环Python实现_第2张图片五环实现

import turtle
turtle.showturtle()
#第一个圆
turtle.width(10)
turtle.color("yellow")
turtle.circle(50)
#第二个圆
turtle.penup()
turtle.goto(80,0)
turtle.pendown()
turtle.width(10)
turtle.color("red")
turtle.circle(50)
#第三个圆
turtle.penup()
turtle.goto(160,0)
turtle.pendown()
turtle.color("green")
turtle.circle(50)
#第四个圆
turtle.penup()
turtle.goto(50,-70)
turtle.pendown()
turtle.color("pink")
turtle.circle(50)
#第五个圆
turtle.penup()
turtle.goto(110,-70)
turtle.pendown()
turtle.color("blue")
turtle.circle(50)
turtl

 

你可能感兴趣的:(Python,python,开发语言)