Problem 3: Conditional Probability Calculator
Easypython
Problem Description
Write a Python program that takes the number of students studying Math, the number studying Science, and the number studying both, and calculates P(Science | Math) using the conditional probability formula.
Input
Three integers: total students, number studying Math, and number studying both Math and Science.
Output
The calculated conditional probability P(Science | Math).
Constraints
- Number studying Math must be greater than 0.
- Number studying both must not exceed the number studying Math.
Example Input
texttotal_students = 100, math_students = 40, both = 10
Example Output
textP(Science | Math): 0.25
Concepts Covered
Conditional probability formula, basic arithmetic, function design.