在第1部分中,您整合了一个简单的机率计算器以确定从给定的一副牌中抽到指定牌面或花色的机率。
In Part 1, you put together a simple odds calculator to determine the chance of pulling a card of a specific face or suit from a given set of CARDS.
要获得抽到特定牌的机率,我们需要一个函数来遍历整副牌并估算其余牌以查看是否匹配。
To get the odds of drawing a specific card, we need a function to walk through the whole deck and evaluate the remaining CARDS to see if they match.
然后可以查看这副牌,看看剩余多少张牌以及抽到特定牌的机率是多少。
Then we can look in the deck to see how many CARDS are left and what the odds are of drawing a specific card.
应用推荐