python list rotation code example Example: how to rotate the list in python li=[1,2,3,4,5,6] li[2:]+li[:2] #rotates list left by 2