I want to shuffle a list 6 times but I keep getting the same result for all the 6 occasions. Can somebody help me find where the fault is?
Here is the code I used
import random
lis1=[0,1,2,3]
lis2=[]
for i in range(6):
random.shuffle(lis1)
lis2.append(lis1)
print lis2
And here is a sample result I got
[[1,3,2,0],[1,3,2,0],[1,3,2,0],[1,3,2,0],[1,3,2,0],[1,3,2,0]]
If I get jumbled lists, how can I sort them in ascending order? As in,I want to get this -
[[0,1,2,3],[2,3,1,0],[2,1,3,0],[1,0,3,2]]
into this-
[[0,1,2,3],[1,0,3,2],[2,1,3,0],[2,3,1,0]]