python 常用函数库

数学函数库

简单的加减乘除可直接使用,但当要使用开方取绝对值的操作时,需要引入python的数学函数库

import math
import math
a = 5
print(math.sqrt(a))

请添加图片描述

随机数

import random
i = 1
while(i < 5):
    i = i+1
    print("the random function")
    print(random.random())#random函数随机产生0-1的任意实数
    print("the uniform function")
    print(random.uniform(1, 5))#uniform函数随机产生自定义范围内的函数

猜你喜欢

转载自blog.csdn.net/qq_52109814/article/details/121660722