How to remove a random element from a list and add it to another list in python
<p><code>list = ['john','james','michael','david','william']</code></p>

<p><code>winner = []</code></p>

<p>How can I remove a random item from <code>list</code> and add it to <code>winner</code>?</p>

<p>Simply use random.randint from index 0 to len(list) to get the index of the element of list and append it to winner.</p>

<pre><code>import random
index = random.randomint(0, len(list)-1)
winner.append(list[index])
del list[index]
</code></pre>

python list random-access