Python Logo
Python二级在线二级在线
首页选择题程序题成为会员帮助

小星星

请修改编辑器中的代码,完成以下功能:利用 random 库和 turtle 库,在屏幕上绘制4个小雪花。雪花的中心点坐标由列表 points 给出,雪花的半径长度由 randint() 函数产生,雪花的颜色为红色。 坐标示例: points = [(0, 0), (50, 50), (-50, -50), (100, -100)]

# 在____________上补充代码
# 请不要修改其他代码
#

import turtle as t
import random as r

r.seed(1)
t.pensize(2)
t._____(1)___('red')
angles = 6
points= [[0,0],[50,40],[70,80],[-40,30]]

for i in range(______(2)_____):
    x0,y0 = points[i]
    t.penup()
    t.goto(____(3)_____)
    t.pendown()

    length = r.randint(6, 16)
    for j in range(angles):
        t._______(4)____(length)
        t.______(5)_____(length)
        t.right(360 / angles)
t.done()

控制台

调试终端

准备就绪