def rotate_list_left(_list : list, rotation_value: int):
result_list = _list.copy()
for k in range(0, len(_list)):
result_list[k-rotation_value] = _list[k]
return result_list
# rotate right with slicing
def rotate_list_right(lst, rotation_value):
result_list =lst[-rotation_value:]+lst[:-rotation_value]
print(result_list)
rotate_list_right([1,2,3,4,5,6],1)
rotate_list_right([1,2,3,4,5,6],2)
# rotate right with for loop
def rotate_list_right(lst, rotation_value):
result_list =lst.copy()
for k in range(0, len(lst)):
result_list[k] = lst[k-rotation_value]
print(result_list)
rotate_list_right([1,2,3,4,5,6],1)
rotate_list_right([1,2,3,4,5,6],2)
# rotate left with slicing
def rotate_list_left(lst, rotation_value):
result_list =lst[rotation_value:]+lst[:rotation_value]
print(result_list)
rotate_list_left([1,2,3,4,5,6],1)
rotate_list_left([1,2,3,4,5,6],2)
# rotate left with for loop
def rotate_list_left(_list : list, rotation_value: int):
result_list = _list.copy()
for k in range(0, len(_list)):
result_list[k-rotation_value] = _list[k]
print(result_list)
rotate_list_left([1,2,3,4,5,6],1)
rotate_list_left([1,2,3,4,5,6],2)