Complete the code to insert an element at the end of the array.
arr = [1, 2, 3] arr.[1](4) print(arr)
The append method adds an element at the end of the list.
Complete the code to add multiple elements at the end of the array.
arr = [1, 2, 3] arr.[1]([4, 5]) print(arr)
The extend method adds all elements from another list to the end.
Fix the error in the code to insert 10 at the end of the array.
arr = [5, 6, 7] arr.[1](10, 3) print(arr)
append takes only one argument and adds it at the end. insert needs index and value, but here we want to add at the end simply.
Fill both blanks to insert 20 at the end of the array using insert method.
arr = [10, 15, 18] arr.[1]([2], 20) print(arr)
Using insert with index equal to the length of the array adds the element at the end.
Fill all three blanks to create a new array by adding 30 at the end using concatenation.
arr = [25, 27] new_arr = arr [1] [[2]] [3] print(new_arr)
Using + concatenates lists. We add a list with one element 30. The - at the end is just to complete the code line (no operation here, but needed to fill blank).