Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-162

Poker Full House Probability

Problem

Probability that a 5-card hand is a full house (three of one rank and two of another) in a deck with ranks ranks and suits suits per rank:

P = ranks * C(suits, 3) * (ranks - 1) * C(suits, 2) / C(ranks * suits, 5).

Return 0.0 for invalid inputs.

Hint

Pick the trips rank, its three suits, the pair rank and its two suits.

Test cases

case 1
in: [13,4]
expected: 0.0014405762304921968
case 2
in: [5,4]
expected: 0.030959752321981424
case 3
in: [2,4]
expected: 0.8571428571428571
Starter codePython
import math


def poker_full_house_probability(ranks, suits):
    # Your code here
    pass

3 test cases · run your code against them in the editor