Write a function to right rotate a given list by given input
Topic: Write a function to right rotate a given list by given input
Solution
def right_rotate(lst, n): n = n % len(lst) return lst[-n:] + lst[:-n]
List all Python Programs
Solution
def right_rotate(lst, n): n = n % len(lst) return lst[-n:] + lst[:-n]