Python语言程序设计第一周作业

1、五角星的绘制

import turtle as t
t.setup(650,350,-180,-180)
t.fillcolor("red")
t.begin_fill()
for i in range(5):
    t.fd(150)
    t.right(145)
t.end_fill()

 2、六角形的绘制

import turtle as t
t.setup(650,350,-150,30)
t.left(90)
for i in range(3):
     t.fd(50)
     t.right(120)
     t.fd(100)
t.seth(30)
for i in range(3):
     t.fd(100)
     t.right(120)
     t.fd(50)

3、叠加等边三角形绘制

import turtle as t
t.setup(650,350,-50,20)
for i in range(3):
    t.fd(50)
    t.right(120)
t.seth(60)
for i in range(3):
    t.fd(50)
    t.right(120)
    t.fd(50)

猜你喜欢

转载自www.cnblogs.com/Mindf/p/12464017.html