What you do is this:
copy = list[2:]
random.shuffle(copy)
which does not do much to the original list. Try this:
copy = list[2:]
random.shuffle(copy)
list[2:] = copy # overwrite the original
More Related Contents:
- Shuffling a list of objects
- Why does random.shuffle return None?
- Is there a way to ordinate numbers in a list?
- How can I randomly select an item from a list?
- Access multiple elements of list knowing their index
- Finding max value in the second column of a nested list?
- What is the most pythonic way to pop a random element from a list?
- How do you pick “x” number of unique numbers from a list in Python?
- Shuffle an array with python, randomize array item order with python
- Select 50 items from list at random
- Create random list of integers in Python
- Better way to shuffle two numpy arrays in unison
- Maximal Length of List to Shuffle with Python random.shuffle?
- Python: Random numbers into a list
- Can Python’s set absence of ordering be considered random order?
- Get a list of numbers as input from the user
- Comparing two lists using the greater than or less than operator
- Getting indices of True values in a boolean list
- Numpy shuffle multidimensional array by row only, keep column order unchanged
- Python: How to sort a list of dictionaries by several values?
- What is the cost/ complexity of insert in list at some location?
- Reading specific columns from a text file in python
- How does str(list) work?
- Nested lambda statements when sorting lists
- Filter a list of tuples based on condition
- How can I convert this string to list of lists? [duplicate]
- Removing an item from a list of lists based on each of the lists first element
- Check list monotonicity
- Can I generate authentic random number with python?
- Generate random array of floats between a range