当前位置:   article > 正文

python123答案-python123第一周作业

python123作业答案

1.使用turtle库绘制一个红色五角星图形

import turtle

turtle.pensize(4)

turtle.pencolor("black")turtle.fillcolor("red")

turtle.begin_fill()

for _ in range(5):

turtle.forward(200)

turtle.right(144)turtle.end_fill()

1966773-20200311121108005-9969759.png

2.使用turtle库绘制一个六角形

import turtle

turtle.setup(650,350,200,200)

turtle.penup()

turtle.pensize(1)

turtle.pencolor("red")

turtle.fillcolor("yellow")turtle.fd(100)

turtle.seth(30)

turtle.pendown()

turtle.begin_fill()

turtle.fd(80)

turtle.seth(-90)

turtle.fd(80)

turtle.seth(150)

turtle.fd(80)

turtle.end_fill()

turtle.penup()

turtle.seth(30)

turtle.fd(80/3)

turtle.seth(90)

turtle.fd(80/3)

turtle.pendown()

turtle.begin_fill()

turtle.seth(-30)

turtle.fd(80)

turtle.seth(-150)

turtle.fd(80)

turtle.seth(90)

turtle.fd(80)

turtle.end_fill()

1966773-20200311121247099-520387069.png

3.使用turtle库绘制一个叠加等边三角形

import turtle

turtle.setup(650,350,200,200)

turtle.penup()

turtle.pensize(1)

turtle.pencolor("red")

turtle.fillcolor("purple")

turtle.begin_fill()

turtle.seth(60)

turtle.pendown()

turtle.fd(50)

turtle.seth(-60)

turtle.fd(100)

turtle.seth(-180)

turtle.fd(100)

turtle.seth(60)

turtle.fd(50)

turtle.seth(0)

turtle.fd(50)

turtle.seth(-120)

turtle.fd(50)

turtle.seth(120)

turtle.fd(50)

turtle.end_fill()

1966773-20200311121419995-832761493.png

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/432858
推荐阅读
相关标签
  

闽ICP备14008679号