iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 24
1
AI & Data

大數據與AI研習實作與心得 系列 第 24

Python - 樂透之呼吸二の型:實際抽法

國慶日補假
繼續在家中寫CODE
/images/emoticon/emoticon13.gif

二の型: 實際抽法49彩球


import random
import numpy as np

biglottery = np.array(range(1,50))

for item in biglottery:
    roll = int (random.random() * 49 )          #找1顆球
    roll2 = int (random.random() * 49  )        #找另1顆球
    temp = biglottery[roll]
    biglottery[roll] = biglottery[roll2]
    biglottery[roll2] = temp                    #滾動交換

print("大樂透號:")
print(biglottery[0:6])
print("特別號:")
print(biglottery[6])

大樂透號:
[42 2 3 17 40 24]
特別號:
33


上一篇
Python - 樂透之呼吸一の型:重抽法
下一篇
Python - pandas (iii) 資料操作
系列文
大數據與AI研習實作與心得 30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言