猫史档案馆


【Python作品分享】【去太空,趣编程】watch the stars

用户:MYBelovedMYBeloved查看:0 回复:1 评论:0 创建时间:2021-05-04T09:12:49


【作品展示】

center_image

 

【作品介绍】

Twinkle, twinkle, little star

 

How I wonder what you are

 

Up above the world so high

 

Like a diamond in the sky.

 

Twinkle, twinkle, little star

 

How I wonder what you are

 

When the blazing sun is gone,

 

When he nothing shines upon

 

Then you show your little light

 

Twinkle, twinkle, all the night.

 

Twinkle, twinkle, little star

 

【作品源代码】

from turtle import *
import random as r

screensize(300,300,"black")
a = ['white', '#66ffff', '#ffff33', 'white', 'purple', 'orange']
d = [5, 7, 9, 11, 13]
t = [4, 5, 6, 7, 8, 9]
y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
pensize(1)
for i in range(50):
    penup()
    e = r.choice(y)
    print(e)
    b = r.randint((-200), 200)
    c = r.randint((-200), 200)
    u = r.choice(t)
    goto(b, c)
    pendown()
    p = r.choice(a)
    w = r.choice(d)
    if e == 0:
        dot(3,p)
    elif e == 1 :
        dot(3, p)
    elif e == 2:
        dot(3, p)
    elif e == 8:
        for i in range(u):
            pencolor(p)
            forward(5)
            right((360 / u))
    elif e == 7:
        for i in range(u):
            pencolor(p)
            forward(5)
            right((360 / u))
    elif e == 5:
        for i in range(u):
            pencolor(p)
            forward(5)
            right((360 / u))
    else:
        for i in range(w):
            pencolor(p)
            forward(20)
            right((180 - 180 / w))

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
猫老祖05猫老祖05

星星好美

点赞0


评论