def rotate_reverse(lst, dist):
 n = len(lst)
 sublist_reverse(lst, 0, (dist - 1))
 sublist_reverse(lst, dist, (n - 1))
 sublist_reverse(lst, 0, (n - 1))

def rotate_reverse ( lst , dist ) : n = len ( lst ) sublist_reverse ( lst , 0 , ( dist - 1 ) ) sublist_reverse ( lst , dist , ( n - 1 ) ) sublist_reverse ( lst , 0 , ( n - 1 ) )
uses reversing to rotate the list .