Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers \$x_1, x_2, x_3... x_n\$ representing n rounds of coin flipping.
At each round, we randomly flip \$x_i\$ number of coins at random. i.e Coins that were heads become tails, and vice versa. Within each round, every coin can be flipped at most once, i.e no repeats.
Objective Write the shortest function that takes as input a list of integers, and calculates the expected number of heads at the end of all rounds.
Assume that the inputs will always correct, i.e every element is between 0 to 10.
# 3 coins chosen at random were flipped over one round, hence E(Heads) = 3 Input =  Output = 3
# 5 coins chosen at random were flipped in the first round # At the second round, only 1 was random flipped with 50% chance of # picking a head/tail. E(Heads) = 0.5*6 + 0.5*4 # Hence E(Heads) = 5 Input = [5, 1] Output = 5