Write Python3 code to demonstrate Shift from Front to Rear in List using list slicing and "+" operator


Topic: Write Python3 code to demonstrate Shift from Front to Rear in List using list slicing and "+" operator

Solution

test_list = [1, 4, 5, 6, 7, 8, 9, 12] 
print ("The original list is : " + str(test_list)) 
test_list = test_list[1 :] + test_list[: 1] 
print ("The list after shift is : " + str(test_list)) 



List all Python Programs