from macslib import * # create a new deck of cards print "Creating new deck" deck = generateDeck() # examine the contents of the deck variable # can you determine how the data is organized? print deck # call this function to find the probability and print the result def findProbability(deck, replace, *cardArgs): print "" probability = cardProbability(deck, replace=replace, *cardArgs) textPercent = str(round(probability, 6) * 100) + "%" textDraws = ""; then = "" for cards in cardArgs: if type(cards) == str: textDraws += then + str(cards) else: textDraws += then + " or ".join(cards) then = ", then " if replace: textReplace = "with" else: textReplace = "without" print "Probability of drawing " + textDraws + " (" + textReplace + " replacement) is " + textPercent # findProbability(deck, False, 'ace:spades') # the probability of drawing an ace of spades without replacement # findProbability(deck, True, 'king:black', ('3','5')) # the probability of drawing a black king, then either a 3 or a 5 with replacement # add more probabilies below!