I am new to Python and have some problems creating random lists.
I am using random.sample(range(x, x), y) .
I want to get 4 lists with unique numbers starting from 1-4, so I used this
a = random.sample(range(1, 5), 4) b = random.sample(range(1, 5), 4) c = random.sample(range(1, 5), 4) d = random.sample(range(1, 5), 4)
So, I get, for example,
a = 1, 3, 2, 4 b = 1, 4, 3, 2 c = 2, 3, 1, 4 d = 4, 2, 3, 1
How can I make a column unique?
python list random
PythonUserNew
source share