# Arup Guha
# 2/1/2012
# Simulates buying packs of baseball cards until a whole set of
# cards is acquired.

import random

def main():

    # Initialize variables.
    random.seed()
    cards = []
    numpacks = 0

    # Keep on buying packs until we get all the cards.
    while len(cards) < 792:

        # Generate one pack of cards.
        for i in range(15):

            nextcard = random.randint(1,792)

            # Add this card if it's not already in the set.
            if not (nextcard in cards):
                cards.append(nextcard)
                #print("in pack",numpacks+1,"adding card",nextcard)

        # Update the number of packs we bought.
        numpacks = numpacks + 1

    # Print out how many packs we had to but to get the complete set.
    print("You collected the set by buying",numpacks,"packs.")

main()

        
