Python—五角星作业

这两段代码使用Python的Turtle库绘制图形。第一个程序画了一个红色和绿色相间的正方形,而第二个程序绘制了一个渐变色的圆形,颜色从浅绿到深绿。第三个程序则画了一个填充为红色的五角星,边长为200像素。所有程序都涉及到了线宽、颜色选择和角度计算。

#Square.py

import turtle as tl

tl.color("red")

tl.forward(100)

tl.left(90)

tl.forward(100)

tl.left(90)

tl.color("green")

tl.forward(100)

tl.left(90)

tl.forward(100)

#Square_Screw.py 2111441

from turtle import *

pensize(3)

bgcolor('black')

colormode(255)

pencolor((51,204,120))

for i in range(100):

fd(i+(i*2))

left(90)

hideturtle()

done()

#FivePointStar.py 211441

from turtle import *

pensize(5)

pencolor("green")

fillcolor("red")

begin_fill()

while True:

fd(200)

right(144)

if abs(pos())<1:

break

end_fill()

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值