# 用变量,for循环画一个五角星 in2
# 3rt Ins
import random
import turtle
changdu=100
jiaodu=144
turtle.speed(0)
for r in range(100):
x = random.randint(-350, 350)
y = random.randint(-350, 350)
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
for z in range(5):
turtle.forward(changdu)
turtle.right(jiaodu)
# pendown
turtle.done()
import random
# 产生0-1的随机小数 random随机的意思
a = random.random()
print(a)
# 产生随机整数
b = random.randint(1,100)
print(b + a)
a = 1
b = 2
print(123-b)
来源:CSDN
作者:少儿编程侯老师
链接:https://blog.csdn.net/houlaos/article/details/104121221