TypeError when assigning a random value from a list to a variable?
<p>I have a list and I want to assign a random element from that list to a new variable five times in order to generate a hand of cards. I've searched, and I can't seem to understand why my random.choice is causing errors.</p>

<pre><code>import random

cards = { '2' '3' '4' '5' '6' '7' '8' '9' 'J' 'Q' 'K' 'A' }

for newCard in range(5):
        newDraw = random.choice(cards)
        playerdeck.append(newDraw)
        if newDraw in playerdeck:
                playermatches = playermatches + 1
        newDraw = oldDraw
</code></pre>

<p>When I try to run it I get this error:</p>

<pre><code>Traceback (most recent call last):
  File "C:\Users\Nathaniel\Desktop\Fcard.py", line 6, in &lt;module&gt;
    newDraw = random.choice(cards)
  File "C:\Python32\lib\random.py", line 253, in choice
    return seq[i]
TypeError: 'set' object does not support indexing
</code></pre>
