K append problem

i am unable to find error in the code :

hello @soorya19k

value of k can be greater than n (size of list) as well.
so first do k=k%n (to make k smaller than n) and then apply ur logic

thanks issue is resolved now!!