码迷,mamicode.com
首页 >  
搜索关键字:random    ( 7215个结果
常用模块
常用模块 1. 时间模块 2. random模块 3. os模块 4. sys模块 一.时间模块 在Python中,通常有这几种方式来表示时间: 1.时间戳(timestamp):通常来说,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量。我们运行“type(time.time ...
分类:其他好文   时间:2020-03-30 20:07:15    阅读次数:84
random模块
import random?print(random.random())#(0,1) float 大于0且小于1之间的小数?print(random.randint(1,3)) #[1,3] 大于等于1且小于等于3之间的整数?print(random.randrange(1,3)) #[1,3) 大 ...
分类:其他好文   时间:2020-03-30 19:58:08    阅读次数:59
有进度条圆周率计算
一、用python计算圆周率pi (1)蒙特卡罗法 1 from random import random 2 from time import perf_counter 3 DARTS = 1000 4 hits = 0.0 5 start = perf_counter() 6 for i in ...
分类:其他好文   时间:2020-03-30 19:53:38    阅读次数:88
random模块
random模块 print(random.random()) #(0,1) float 大于0且小于1之间的小数 print(random.randint(1, 3)) # [1,3] 大于等于1且小于等于3之间的整数 print(random.randrange(1, 3)) # [1,3) 大 ...
分类:其他好文   时间:2020-03-30 16:06:18    阅读次数:55
汽车安全性评估数据分类
import pandas as pd # 加载数据集 df = pd.read_csv( "http://labfile.oss.aliyuncs.com/courses/1211/car.data", header=None) # 设置列名 df.columns = ['buying', 'ma ...
分类:其他好文   时间:2020-03-29 19:50:09    阅读次数:196
SLS求解器学习walkSAT3
walksat2013版本的函数 重点函数之一 1 //cpick means computing break values and pick, this function is adopted for random 4-SAT 2 int cpick_bbreak_gmake() 3 { 4 in ...
分类:其他好文   时间:2020-03-29 12:48:32    阅读次数:64
线程_事件
线程的一个关键特性是每个线程都是独立运行且状态不可预测。 如果程序中的其他线程需要通过判断某个线程的状态来确定自己下一步的操作,这时我们需要使用threading库中的Event对象。 event.set():设置事件状态为True event.wait ():等待event.set 把事件状态设置 ...
分类:编程语言   时间:2020-03-29 10:43:21    阅读次数:65
Python 课程成绩分析
第一件事当然是生成学生的分数,这里我是自己随机生成的,直接看代码,注释都写得很详细了 1 import random 2 import json 3 4 5 def random_score(sum, bottom, top): 6 ''' 7 :param sum: 生成随机数总数 8 :para ...
分类:编程语言   时间:2020-03-29 01:15:04    阅读次数:130
线程_递归锁
#死锁:锁只能抢一次,释放后被其他人抢 from threading import Thread,Lock,current_thread import time class MyThread(Thread): def run(self): self.f1() self.f2() def f1(sel ...
分类:编程语言   时间:2020-03-28 23:43:26    阅读次数:94
五种方法实现python3-随机生成10位包含数字和字母的密码
方法一:知识点:random.sample(sequence,k)从指定序列中随机获取指定长度的片断importrandom,stringnum=string.ascii_letters+string.digitsprint("".join(random.sample(num,10)))方法二:知识点:random.choice(sequence)从序列中获取一个随机元素‘‘‘遇到问题没人解答?小
分类:编程语言   时间:2020-03-28 21:50:06    阅读次数:98
7215条   上一页 1 ... 63 64 65 66 67 ... 722 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!