binrui -亮瞎你的钛合金狗眼-群星乱舞

import turtle as t
import random  # 产生随机数

t.color("yellow", "yellow")
t.shape("turtle")
t.width(2)
t.speed(0)
a = 100
b = 144

# bgm
t.bgcolor("black")

for ii in range(100):
    t.up()
    x = random.randint(-350, 350)
    y = random.randint(-200, 200)
    t.goto(x,y) # x y
    t.down()
    t.begin_fill()
    for i in range(5):
        t.fd(a)
        t.rt(b)
    t.end_fill()


t.done()



·

命名方法

# import turtle
# import turtle as t   # 重命名
# from turtle import left, right, color, done # 从turtle工具包导入left和done的方法
# from turtle import *  # 从turtle工具包导入所有方法
#
# # forward ---> fd    left  ---> lt    right --> rt
# color('blue')
# fd(100)
# left(123)
# done()

import random
a = random.randint(1,100)  # 产生随机整数
b = random.random()   # 产生0-1随机小数

print(a)
print(b)
print(a+b)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值