Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def probability(n,p):
- prob = math.factorial(n) /math.factorial(n-p) * math.factorial(p)
- return prob
- def main():
- n = int(input("Enter the number of lottery balls: "))
- p = int(input("Enter the number of drawn balls: "))
- if n <= 0:
- print("The number of balls must be a positive number.")
- if p > 39:
- print("Ar most the total number of balls can be drawn.")
- else:
- print("The probability of guessing all", n ,"balls correctly is", probability(n,p))
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement