""" deck.py A example of a deck of cards """ import random def make_deck(): """ Return a deck of 10 cards """ deck = range(1,11) random.shuffle(deck) # note that this changes deck return deck def pull_random_card(deck): """ Return one card and the smaller deck. """ card_index = random.randrange(len(deck)) card = deck.pop(card_index) # note that this changes deck return card, deck def main(): d = make_deck() print "Original deck: " + str(d) your_card, d = pull_random_card(d) print "Your card is " + str(your_card) print "The deck is now: " + str(d) main()