py123第一次作业

 
绘制五角星<br>import turtle
turtle.setup(600,350,200,200)
turtle.pensize(2)
turtle.pencolor("black")
turtle.fillcolor("red")
turtle.begin_fill()
for i in range(5):
    turtle.forward(200)
    turtle.right(144)
turtle.end_fill()
1 value = eval(input())
2 
3 list= []
4 for i in range(6):
5     num = value ** i
6     list.append(str(num))
7 
8 print(" ".join(tuple(list)))
View
value = eval(input())

list= []
for i in range(6):
    num = value ** i
    list.append(str(num))

print(" ".join(tuple(list)))
Co
 使用龟库绘制一个红色五角星图形,
#绘制五角星<br>
import turtle
turtle.setup(600,350,200,200)
turtle.pensize(2)
turtle.pencolor("black")
turtle.fillcolor("red")
turtle.begin_fill()
for i in range(5):
    turtle.forward(200)
    turtle.right(144)
turtle.end_fill()



d六角形的投射  ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬ ‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‮‬  描述 使用龟库绘制一个六角形,效果如下e

from turtle import *
width(5)
pencolor("green")
fillcolor("violet")
begin_fill()
while True:
    forward(100)
    right(-60)
    forward(100)
    right(120)
    if abs(pos()) < 1:
        break
end_fill()
forward(100)
right(0)
pencolor("purple")
forward(100)
right(60)
forward(100)
right(60)
forward(100)
right(60)
forward(100)
right(60)
forward(100)
right(60)
forward(100)
right(60)

引入等边三角形投影  ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬ ‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‮‬  描述 使用龟库绘制一个叠加等边三角形

import turtle as t
t.setup(600, 600, None,None)
t.pu()
t.fd(-120)
t.pensize(5)
t.width(5)
t.pencolor("darkgreen")
t.pd()
t.fd(250)
t.seth(120)
t.pencolor("black")
t.fd(250)
t.seth(-120)
t.pencolor("blue")
t.fd(250)
t.pencolor("purple")
t.fd(250)
t.seth(0)
t.pencolor("green")
t.fd(250)
t.pencolor("gold")
t.fd(250)
t.seth(120)
t.pencolor("yellow")
t.fd(250)
t.seth(-120)
t.pencolor("grey")
t.fd(250)
t.seth(120)
t.pencolor("pink")
t.fd(250)
原文地址:https://www.cnblogs.com/zzalovelyq/p/12463943.html