Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-018

Indicator Expectation

Problem

Return the expected number of successes when probs holds the success probabilities of independent indicator variables.

By linearity of expectation E[sum of indicators] = sum(probs). An empty list returns 0.0.

Test cases

case 1
in: [[0.1,0.2,0.3]]
expected: 0.6
case 2
in: [[0.5,0.5]]
expected: 1
case 3
in: [[]]
expected: 0
Starter codePython
def indicator_expectation(probs):
    # Your code here
    pass

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