arr = [0, 1, 2, 3, 4] del arr[1] # arr is now equal to [0, 2, 3, 4]
Here is what the above code is Doing:
1. We create an array called arr.
2. We delete the element at index 1.
3. We print the array.
4. We print the length of the array.
arr = [0, 1, 2, 3, 4] del arr[1] # arr is now equal to [0, 2, 3, 4]
Here is what the above code is Doing:
1. We create an array called arr.
2. We delete the element at index 1.
3. We print the array.
4. We print the length of the array.