学生优秀编程代码展示二

[日期:2022-05-31] 作者:信息技术 次浏览 [字体: ]

2023届八班徐悦琳同学编写的程序代码如下:

import turtle as t

import random
t.speed(1000)
t.pensize(2)
i=2;
colors=["red","orange","yellow","green","cyan","blue","purple"]
while True:
    x=random.randint(-240,240)
    y=random.randint(-180,180)
    a=random.randint(0,6)
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.pencolor(colors[a])
    t.fillcolor(colors[a])
    t.begin_fill()
    t.circle(i)
    t.end_fill()
    i+=1