I'm trying to create draws without replacement, and output the result of each draw as a text file. The list is in a separate file, and I want to re-import it for each iteration of my loop
import random
import numberlist
counter=0
draws= 100
while (counter<draws):
x= numberlist.listX #this imports a list of strings eg. ['a341','c32k','42b]]
random.shuffle(x)
x.pop()
"""OPERATIONS WITH POPPED VALUE"""
counter += 1
What I was hoping for was that X would be realitialized to the the complete listX at the beginning of every loop iteration. Instead what I"m finding is that every time I pop a number, the list gets smaller every loop iteration. Why is this happening, and how can I get around it?
Thank you.