python学习笔记:turtle库绘制叠边形

turtle库绘制叠边形

用turtle库,绘制一个叠边形,其中,叠边形内角为100度

import turtle as t
t.setup(600,600)
t.penup()
t.goto(0,50)
t.pendown()
t.pensize(2)
t.pencolor(0,0,0)
t.left(20)
t.fd(50)
t.right(80)
t.fd(50)
for i in range(8):
    t.left(40)
    t.fd(50)
    t.right(80)
    t.fd(50)
for i in range(9):
    t.fd(76.60444431515054)
    t.right(40)
t.done()
发布了51 篇原创文章 · 获赞 34 · 访问量 899

猜你喜欢

转载自blog.csdn.net/weixin_43412569/article/details/104857384