I\'m trying to shuffle only elements of a list on 3rd till last position so the 1st two will always stay in place e.g.
list = [\'a?\',\'b\',\'c\',\'d\',\'e\'
l[2:] constructs a new list, and random.shuffle tries to change the list "in-place," which has no effect on l itself.
l[2:]
random.shuffle
l
You could use random.sample for this:
random.sample
l[2:] = random.sample(l[2:], len(l)-2)