Python手册(Standard Library)--math+random

目录


math

math import math
math.truck(x) 取整
math.ceil(x) 天花板
math.floor(x) 地板
math.exp(x)
math.log(x)
math.pow(x,y) x**y
math.sqrt(x)
math.log10(x)
math.nan 缺失值
math.inf
math.pi π
math.e 自然常数

random

random import random
random.choice(seq) 随机挑选一个元素
random.randrange(start,stop,step) 从指定范围内,获取一个随机数
random.random() 随机生成一个实数[0,1)
random.uniform(x, y) 随机生成一个实数[x,y]
random.seed()
random.shuffle(lst) 随机排序

猜你喜欢

转载自blog.csdn.net/qq_41518277/article/details/80261109
今日推荐