You can create the enumeration of the elements by something like this:
mylist = list(xrange(10))
Then you can use the random.choice
function to select your items:
import random
...
random.choice(mylist)
As Asim Ihsan correctly stated, my answer did not address the full problem of the OP. To remove the values from the list, simply list.remove()
can be called:
import random
...
value = random.choice(mylist)
mylist.remove(value)
As takataka pointed out, the xrange
builtin function was renamed to range
in Python 3.