Solution (source code)

= Solution

The lecture attendances are independent <Bernoulli trials> with success probability $f$. Their count has the <binomial distribution>:
$$
\boxed{P(k\mid K,f)=\binom Kk f^k(1-f)^{K-k},\qquad0\leq k\leq K.}
$$