Follow-up question of: Python swap indexes using slices
r = [\'1\', \'2\', \'3\', \'4\', \'5\', \'6\', \'7\', \'8\']
If I want to swap sli
Without any calculation, you can do :
def swap(r,a,b,c,d): assert a<=b<=c<=d r[a:d]=r[c:d]+r[b:c]+r[a:b]