机器人
积分排行榜
Scratch
积分排行榜
Python
在线答题
积分排行榜
活跃排行榜
打字练习
Microbit
C++
在线答题
积分排行榜
活跃排行榜
网盘
积分
未登录
未登录
登录学习
作者:
许轩豪
更新时间:
2025-06-14 11:54
浏览:
24次
点赞:
0次
热度:
20
import turtle import random turtle.hideturtle() t = turtle.Pen() turtle.speed(000) color = ["red","blue","yellow","black","gold"] num = int(input("请输入一个整数,表示气球数量:")) num2 = int(input("请输入一个整数,表示气球大小:")) for i in range(50): a = random.randint(-200,200) b = random.randint(-300,300) t.penup() t.goto(a,b) t.begin_fill() t.pendown() t.color(color[i%5]) c = random.randint(1,4) if c == 1: t.circle(num2) elif c == 2: for i in range(3): t.forward(num2) t.left(120) elif c == 3: for i in range(5): t.forward(num2) t.right(144) elif c == 4: for i in range(6): t.forward(num2) t.right(60) t.end_fill()
点赞成功
分享作品
×