🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` #生成一个包含10个0~100之间随机整数的列表 #[45, 47, 58, 77, 76, 38, 38, 5, 9, 83] import random line = [] for i in range(10): #line.append(i) line.append(int(random.random()*100)) print(line) a = random.random() #print(a) ``` ``` line = [45, 47, 58, 77, 76, 38, 38, 5, 9, 83] ``` ``` #3.14之间5.6 import random a = random.uniform(3.14,8.6) print(a) ``` ``` import turtle import random turtle.pencolor("red") for i in range(30): turtle.penup() #turtle.goto(10,10) #turtle.goto(random.random()*100*i,random.random()*100*i) turtle.goto(random.randint(-300,300),random.randint(-300,300)) turtle.pendown() s = random.randint(2,8) turtle.circle(30,steps=s) turtle.done() ```