So I was attempting to write a very basic function that can move every element in the list one index earlier. And I think I am actually pretty close to the result I want.
For example if a list is
l = [1, 2, 4, 5, 'd']
I want it to be like that afterwards
l = [2, 4, 5, 'd', 1]
The reality of my code
l = [2, 4, 5, 1, 1]
Here is my code, I just don't know what is happening here after a lot of random attempts on changing the code...
Thank you guys in advance!
def cycle(input_list):
count = 0
while count < len(input_list):
tmp = input_list[count - 1]
input_list[count - 1] = input_list[count]
count+=1