摘要: 我之前只知道设置初始值0.今天偶然在Python算法书上看到这个片段,从100个随机数里面找2个最靠近的自然数(不相等):from random import randrange seq = [randrange(10**10) for i in range(100)] dd = float("inf") for x in seq: for y in seq: if x == y: continue d = abs(x-y) if d >> float('-Inf')==-float('Inf')True顺便还收获了NaN的概念, 阅读全文
posted @ 2013-11-12 11:05 LisPythoniC 阅读(40616) 评论(0) 推荐(0) 编辑