Python模块random-创新互联

python 模块 random

In [1]: import random

In [2]: random.uniform(0.7,5)
Out[2]: 0.7418808135797732

In [3]: random.uniform(0.7,5)
Out[3]: 1.20091265582769

In [4]: random.uniform(0.7,5)
Out[4]: 4.7791965347089125

In [5]: random.uniform(0.7,5)
Out[5]: 2.7882796316003295
In [6]: random.choice([2,3,4,5])
Out[6]: 3

In [7]:

In [7]: random.choice([2,3,4,5])
Out[7]: 3

In [8]: random.choice([2,3,4,5])
Out[8]: 5

In [9]: random.choices([2,3,4,5])
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
 in ()
----> 1 random.choices([2,3,4,5])

AttributeError: 'module' object has no attribute 'choices'

python3 有choices

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

专注于为中小企业提供做网站、成都做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业陕西免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了数千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
当前名称:Python模块random-创新互联
文章URL:http://myzitong.com/article/dgogsj.html