Complete the code to remove the last element from the list.
arr = [1, 2, 3, 4, 5] arr.[1]() print(arr)
The pop() method removes the last item from the list.
Complete the code to delete the last element using the del statement.
arr = [10, 20, 30, 40] del arr[1] print(arr)
Using del arr[-1] deletes the last element by index.
Fix the error in the code to remove the last element safely.
arr = [] if arr: arr.[1]() print(arr)
Using pop() inside a check ensures no error if the list is empty.
Fill both blanks to remove the last element and print it.
arr = [5, 6, 7] last = arr[1]() print([2])
pop() removes and returns the last element, which is stored in last.
Fill all three blanks to remove the last element by index and print the updated list.
arr = [9, 8, 7, 6] index = [1] removed = arr.[2](index) print([3])
Using pop(-1) removes the last element by index and returns it. Printing arr shows the updated list.
