彭彥瑜python math random

w3schools學習python math random函式庫

import math #彭彥瑜 輸入數學函式庫
import random #輸入亂數資料庫
x = math.sqrt(2)
print(x)
#大樂透是49個號碼開出六個
for i in range(6):
   x = random.randit(1,49)
   print("開出的第" + str(1+1) + " 個號碼: " + str(x))
#str是將數字轉成字串string

w3schools學習python math random截圖

亂數函數主要用在蒙地卡羅模擬分析,用於衍伸性金融商品的訂價

貪吃蛇的python程式

影片

留言

張貼留言

這個網誌中的熱門文章

彭彥瑜利用日資學習五日平均總黃金交叉、死亡交叉

彭彥瑜Unicode,UTF-8,資料型態