使用python编程实现绘制奥运五环图

程序

主要是通过导入turtle包,turtle包是python中很流行的绘制图形的函数库。

#绘制五环

import turtle     #导入turtle模块
turtle.width(10)  #线的宽度
turtle.color("blue")  #环的颜色
turtle.circle(50) #环的半径

turtle.penup()         #把画笔抬起,不画
turtle.goto(120,0)     #笔移动到(120,0)的坐标位置
turtle.pendown()       #开始画
turtle.color("black")  #环的颜色
turtle.circle(50) #环的半径

turtle.penup()         #把画笔抬起,不画
turtle.goto(240,0)     #笔移动到(240,0)的坐标位置
turtle.pendown()       #开始画
turtle.color("red")  #环的颜色
turtle.circle(50) #环的半径

turtle.penup()         #把画笔抬起,不画
turtle.goto(60,-50)     #笔移动到(120,0)的坐标位置
turtle.pendown()       #开始画
turtle.color("yellow")  #环的颜色
turtle.circle(50) #环的半径

turtle.penup()         #把画笔抬起,不画
turtle.goto(180,-50)     #笔移动到(120,0)的坐标位置
turtle.pendown()       #开始画
turtle.color("green")  #环的颜色
turtle.circle(50) #环的半径

运行结果

在这里插入图片描述

  • 6
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值