Random Module help

Jeff Shannon jeff at ccvcorp.com
Wed Feb 13 14:58:36 EST 2002


Bo Vandenberg wrote:

> Wouldnt you have to dump your initial deck into a string or tuple and then
> remove cards as they were played?
>
> That would set you up to deal elegantly with multiple hands from the same
> deck.

Those wouldn't work, because strings and tuples are immutable--you can't
remove anything from them.  You could, however, put them in a list.

deck = random.shuffle(newdeck())
for card in range(len(hand)):
    hand[card] = deck.pop()

Or some such.

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list