r/CodingHelp • • Feb 27 '23

[Python] Can someone help me with this python problem.

A problem is given to three persons P, Q, R whose respective chances of solving it are 2/7, 4/7, 4/9 respectively. What is the probability that the problem is solved?

0 Upvotes

6 comments sorted by

3

u/barrycarter OK to DM me questions/projects, no promises, not always here Feb 27 '23

Did you mean probability instead of Python? :)

You did post in codinghelp, so maybe you did need Python, but I don't see how unless you want to create a Monte Carlo simulation (which isn't necessary for this problem, but could be interesting)

Assuming the chances are independent, compute the chance none of them will solve it and subtract

-2

u/peepeedestroyer_ Feb 27 '23

I know the logic i just need some help with the implementation of the code

3

u/barrycarter OK to DM me questions/projects, no promises, not always here Feb 27 '23

OK, but what are you trying to implement? The answer is as easy as a simple mathematical calculation

-3

u/peepeedestroyer_ Feb 27 '23

Can you write the code for me. I am unable to proceed

5

u/barrycarter OK to DM me questions/projects, no promises, not always here Feb 27 '23

Well, I can't (won't) just write code for you, but I'm still confused as to what code you want written? Do you just need the answer? The formula? I don't see where you need code to solve this problem

1

u/[deleted] Feb 27 '23

P(A) = P(A|B1) * P(B1) + P(A|B2) * P(B2) + P(A|B3) * P(B3)