Help me in solving DSAAGP08 problem

My issue

where we can give output and answer

My code

# Initial array
arr = [2, 4, 6, 8, 10]
size = 5  # Current size of the array

position_to_delete = 2  # Index of the element to delete

# Shift elements to fill the gap left by the deleted element



# Update the size of the array

# Print the updated array
for i in range(size):
    print(arr[i], end=" ")


Learning course: BCS301: Data structures
Problem Link: https://www.codechef.com/learn/course/abesit-dsa/ABESITDS05/problems/DSAAGP08

here the correct code

# Initial array
arr = [2, 4, 6, 8, 10]
size = 5  # Current size of the array

position_to_delete = 2  # Index of the element to delete

# Shift elements to fill the gap left by the deleted element
for i in range(position_to_delete,size-1):
    temp = arr[i]
    arr[i]=arr[i+1]
    arr[i+1]= temp



# Update the size of the array
size= len(arr)-1


# Print the updated array
for i in range(size):
    print(arr[i], end=" ")