I know how to shuffle a list of elements. But hos should I do if I want to shuffle all the elements between two specific elements.
import random
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
random.shuffle(x)
print(x)
I tried following way, but it produce "None".
import random
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
random.shuffle(x[2:5]) # need an output like this e.g: [1, 2, 4, 5, 3, 6, 7, 8, 9, 10]
print(x)
But it didnt work. Thanks for the help.