第一周python作业
绘制五角星
from turtle import* setup(400,400,0,0) penup() fd(-80) pendown() fillcolor("red") begin_fill() for i in range(5): fd(100) right(144) end_fill() done
绘制六角星
from turtle import* setup(400,400,0,0) penup() fd(-50) seth(30) pendown() fillcolor("yellow") begin_fill() for i in range(6): left(60) fd(80) right(120) fd(80) for j in range(6): fd(80) right(60) end_fill() done
叠加三角形
def sjx(): for i in range(3): fd(100) left(120) from turtle import* sjx() right(120) sjx() fd(100) left(120) fd(100) sjx() done