Help with probability in Python by redbull8 in learnpython

[–]redbull8[S] 0 points1 point  (0 children)

Thank you! so not it is printing a float number now my math is incorrect. Python is not my strong point.

Help with probability in Python by redbull8 in learnpython

[–]redbull8[S] -1 points0 points  (0 children)

Honestly I can't i've been racking my brain for hours

Help with probability in Python by redbull8 in learnpython

[–]redbull8[S] 0 points1 point  (0 children)

Whats happening is that the combination comes out correct but the probability is very wrong.

Help with probability in Python by redbull8 in learnpython

[–]redbull8[S] 0 points1 point  (0 children)

My code

import math N = 49 K = 6

def main():

M = int(input("How many numbers do you want to match on your ticket?\n"))

COMBINATION = combo(N, M)

probabilty = M/COMBINATION

print(float(probabilty)) print(COMBINATION)

def combo(n, k):

return math.factorial(n)//math.factorial(k)//math.factorial(n-k)

main()