CBSE Class 12 Computer Science
Question 79 of 105
Python Revision Tour II — Question 6
Back to all questions234566
arris initialised as a list with elements [1, 2, 3, 4, 5, 6].forloop iterates over the indices from 1 to 5. For each indexi, it assigns the value ofarr[i]toarr[i - 1], effectively shifting each element one position to the left. After this loop, the listarrbecomes[2, 3, 4, 5, 6, 6].- Second for loop iterates over the indices from 0 to 5 and prints each element of the list
arrwithout newline characters because ofend=""parameter. Then it prints the elements of the modified listarr, resulting in234566.