All problems
Bridge Void Probability
Problem
Probability that a hand of hand_size cards dealt from a deck with four suits of suit_length cards each is void in one specified suit:
P = C(deck - suit_length, hand_size) / C(deck, hand_size)
with deck = 4 * suit_length. Return 0.0 for invalid inputs.
Hint
Choose all cards from the other three suits.
Test cases
case 1
in: [13,13]
expected: 0.012790948037576362
case 2
in: [5,4]
expected: 0.1813186813186813
case 3
in: [1,4]
expected: 0.75
case 4
in: [1,3]
expected: 0.75
Starter codePython
import math
def bridge_void_probability(hand_size, suit_length):
# Your code here
pass4 test cases · run your code against them in the editor