def solution(A):
A_inp = A
roated_a =list(range(len(A_inp)))
k=1
while k < 3:
for i in range(len(A_inp)-1):
roated_a[i+1] = A_inp[i]
roated_a[0] = A_inp[len(A_inp)-1]
A_inp = roated_a
k+=1
print(roated_a)
inp_arr = [int(item) for item in input("Enter the list items : ").split()]
solution(inp_arr)
This code should rotate the input array. Input given : 3 6 8 7 Expected Output should be : 7 3 6 8 ; 8 7 3 6; 6 8 7 3 But I am getting : 7 3 6 8 ; 7 7 7 7 ; 7 7 7 7
How is it getting the 7 for all the index after first iteration ? Where is the error ? Can anyone help ?