What is wrong with my code

ur code will not work when k>=n
so do
k=k%n
if(k!=0)
func()
print(head)