All problems
Hot-Hand Test Statistic
Problem
Return [P(hit after hit), P(hit after miss)] for a binary sequence of 1 (hit) and 0 (miss). A conditional probability with no transitions of that type is reported as 0.0.
Hint
Count transitions out of each state and how often they lead to a hit.
Test cases
case 1
in: [[1,1,1,0,1,0,1]]
expected: [0.5,1]
case 2
in: [[1,0,1,0]]
expected: [0,1]
case 3
in: [[0,0,0]]
expected: [0,0]
case 4
in: [[1]]
expected: [0,0]
Starter codePython
def hot_hand_statistic(sequence):
# Your code here
pass4 test cases · run your code against them in the editor