python中画奥运五环的方法

这篇文章给大家分享的是有关python中画奥运五环的方法的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。

绘制奥运五环主要涉及到Python中的turtle绘图库运用:

python中画奥运五环的方法

程序源代码为:

import turtle
turtle.width(10)
turtle.color('black')
turtle.circle(50)
turtle.penup()
turtle.goto(120,0)
turtle.pendown()
turtle.color('red')
turtle.circle(50)
turtle.penup()
turtle.goto(240,0)
turtle.pendown()
turtle.color('blue')
turtle.circle(50)
turtle.penup()
turtle.goto(60,-50)
turtle.pendown()
turtle.color('yellow')
turtle.circle(50)
turtle.penup()
turtle.goto(180,-50)
turtle.pendown()
turtle.color('pink')
turtle.circle(50)
#Python绘制奥运五环

运行后,结果为:

python中画奥运五环的方法

感谢各位的阅读!关于python中画奥运五环的方法就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到吧!