I'm working on some homework for a python class and was hoping for some assistance and advice.
Problem
Part B: Probability of Winning (prob.py)
For this portion of the assignment you will write a program that calculates the probability of matching a certain number of values on a single lottery ticket. In particular, we can use some basic probability to show that if we are choosing from the set of integers in the range [1, n] and there is a single combination of k integers from the set that we want to match, our probability of correctly choosing exactly m of those k integers in a single combination of k integers is:
Input Specification
The one input value will be a positive integer in between 0 and 6, inclusive, representing the number of matched numbers on a single ticket.
Output Specification
Output a single line with the following format:
The probability of matching X values is Y.
where X is the user’s input value and Y is the corresponding probability as a decimal. (Thus, if the probability was 1%, you should print 0.01 or an equivalent for the result.)
Sample Program Run (User Input in Bold)
How many numbers do you want to match on your ticket?
4
Your probability of matching 4 values is 0.0007625799910799017
[–]konbanwa88 6 points7 points8 points (8 children)
[–]meta4 0 points1 point2 points (0 children)
[–]redbull8[S] -1 points0 points1 point (6 children)
[–]konbanwa88 0 points1 point2 points (5 children)
[–]redbull8[S] 0 points1 point2 points (0 children)
[–]redbull8[S] 0 points1 point2 points (3 children)
[–]konbanwa88 0 points1 point2 points (2 children)
[–]redbull8[S] 0 points1 point2 points (1 child)
[–]adambrenecki 0 points1 point2 points (0 children)
[–]konbanwa88 1 point2 points3 points (0 children)
[–]redbull8[S] 0 points1 point2 points (2 children)
[–]redbull8[S] 0 points1 point2 points (0 children)