Why doesn\'t this work?
# to reverse a part of the string in place a = [1,2,3,4,5] a[2:4] = reversed(a[2:4]) # This works! a[2:4] = [0,0] # Thi
Another way you might consider is to use a reversed slice:
a[2:4] = a[3:1:-1]