Yahtzee 的機率
讓我們計算在一次擲出 5 顆骰子時得到「Yahtzee」的機率。
當 5 顆骰子點數都相同,就會出現 Yahtzee。6 種點數任一種都算 Yahtzee。例如,全是 1 是 Yahtzee,全是 4 也是。
本練習屬於課程
R 的機率謎題
練習說明
- 計算樣本空間的大小。
- 計算得到 Yahtzee 的機率。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Calculate the size of the sample space
s_space <-
# Calculate the probability of a Yahtzee
p_yahtzee <-
# Print the answer
print(p_yahtzee)