First, to compute answers for this problem we need to assume the probability of friend A and friend B each have done a one-time fling is independent. This is probably not actually true since friends likely are similar to each other (someone who has done a one-time fling is more likely to be friends with others who have done one-time flings), but without the assumption we cannot compute probabilities.
(a) P(no one has done one-time fling) = [P(a person has NOT done a one-time fling)]^7 = [1 - P(person has done a one-time fling)]^7 = 0.95^7 ≈ 0.698
(b) P(at least one person has done a one-time fling) = 1 - P(no one has done a one-time fling) ≈ 1 - 0.698 = 0.302 Note that we are reusing the answer to (a) here.
(c) P(no more than 2 people have done a one-time fling) = P(no one has done a one-time fling) + P(exactly 1 person has done a one-time fling) + P(exactly 2 people have done a one-time fling)
Here we can recognize the number of people that have done a one-time fling as a binomial random variable. That means:
P(exactly k people have done a one-time fling) = (7 choose k) * [P(person has done one-time fling)]^k * [P(person has not done a one-time fling)]^(7-k) = 7!/[k!*(7-k)!] * 0.05^k * 0.95^(7-k)
We can calculate each of the 3 terms of the sum by recognizing this is a binomial random variable. For the first term ("no one") we could use the answer from part (a), but we can compute this a different way here as well:
P(no one has done a one-time fling) = 7!/[0! * 7!] * 0.05^0 * 0.95^7 = 0.95^7 ≈ 0.698
P(exactly one person has done a one-time fling) = 7!/[1! * 6!] * 0.05^1 * 0.95^6 = 7 * 0.05 * 0.95^6 ≈ 0.257 Note that here 7!/[1! * 6!] is easy to do in your head (don't calculate out the value of 7! or 6!) since most factors cancel: 7! / [1! * 6!] = (7*6*5*4*3*2*1) / [ 1 * 6*5*4*3*2*1] = (7*6*5*4*3*2*1) / [ 1 * 6*5*4*3*2*1] = 7/1 = 7. Or if you recognize that (7 choose 1) is the number of ways to choose one thing out of 7 you can see this is 7 without doing a calculation at all.
P(exactly 2 people have done a one-time fling) = 7!/(2! * 5!) * 0.05^2 * 0.95*5 = (7*6*5*4*3*2*1) / [2*1 * 5*4*3*2*1] * 0.05^2 * 0.95^5 = 42/2 * 0.05^2 * 0.95^5 = 21*0.05^2 * 0.95^5 ≈ 0.041. Note that you could also compute the 21 value by thinking of (7 choose 2) as the number of ways to choose 2 items out of 7. That could be done as (# choices for the first) * (# remaining choices for second) / 2 = 7*6/2 = 42/2 = 21. Here the divide by 2 is because we could choose the 2 items(people) in any order.
Final answer for (c) is now: 0.95^7 + 7 * 0.05 * 0.95^6 + 21*0.05^2 * 0.95^5 ≈ 0.996 [Note that adding the rounded answers could lead to a rounding error]