# Arup Guha
# 9/18/2014
# Calculates expected winnings (ummm, losings) for a lottery ticket.

import math

WINNINGS = [0, 0, 0, 5, 70, 7660, 5000000]

def main():

    # Use expectation formula over all possible outcomes.
    total = 0
    for i in range(len(WINNINGS)):
        total = total + WINNINGS[i]*matchprob(52, 6, i)

    print("I expect to win",total,"dollars.")

    
# Returns the probability of matching matches values on a ticket.
def matchprob(total,choices,matches):
    return combo(choices,matches)*combo(total-choices,choices-matches)/combo(total,choices)

# Regular combination returns n choose k.
def combo(n,k):
    return math.factorial(n)//math.factorial(k)//math.factorial(n-k)

main()
