天天看點

weixuan - 廷牛X的for循環

# 用變量,for循環,畫一個藍色blue的五角星
import turtle
import random
turtle.bgcolor('black')
turtle.color('white')
turtle.pensize(2)
changdu = 100
turtle.speed(0)
dd=random.randint(50,500)
for ai in range(10000):
    ss = random.randint(1, 720)
    turtle.fd(dd)  # changdu ---> ai 0, 1,2 3, 4,5,6....999
    turtle.circle(dd,20)
    turtle.right(ss)
turtle.done()





           
# 倒入一個産生随機數的工具包
# random 随機
import random
# 産生一個0-1的随機小數,不能寫參數進去
a = random.random()
print(a*100)
# 産生一個0-100的整數
b = random.randint(1,100)
print(b)