I was making a simple function to rearrange a list with very large no of elements say 100,000 or probably 1 million. Here is the code of the function
def Rearrange():
global list1
list1.append(list1[0])
list1.pop(0)
Basically, this just function just appends the first elements of the list at the last and deletes the first element.
When I included the #2 line of the function the time taken to run the function was around 0.002 seconds for a 100,000 size of the list, while if we comment out that line leaving the function with only the upper statement, the time taken was around 5.2 * 10^-6 seconds. How do you explain this large difference?