You will count the orders of successes by listing them, find the probability of one order, and put the two together into the binomial formula. The checker compares your counts with math.comb.
The idea. product("SF", repeat=n) lists every order of trials. Count the orders with exactly k letters S. One order with k successes has probability . The binomial probability is the number of orders times that.
Your tasks.
orders(n, k). List every order and count those with k successes.one_order(p, n, k).binomial(n, p, k). Use your first two functions, not math.comb.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…