Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to remove the first element from the list.
DSA Python
arr = [1, 2, 3, 4] arr.[1] # Remove first element print(arr)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using pop() removes the last element, not the first.
Using remove(0) tries to remove the value 0, not the first element.
✗ Incorrect
Using pop(0) removes the first element from the list.
2fill in blank
mediumComplete the code to delete the first element using the del statement.
DSA Python
arr = [10, 20, 30, 40] del arr[1] # Delete first element print(arr)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or curly braces instead of square brackets.
Trying to delete without specifying the index.
✗ Incorrect
The del statement deletes the element at index 0 using square brackets.
3fill in blank
hardFix the error in the code to remove the first element correctly.
DSA Python
arr = [5, 6, 7, 8] arr.[1](arr[0]) # Remove first element print(arr)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using pop with a value instead of an index causes an error.
Using del as a method is incorrect.
✗ Incorrect
The remove method removes the first occurrence of the given value.
4fill in blank
hardFill in the blank to create a new list without the first element.
DSA Python
arr = [9, 8, 7, 6] new_arr = arr[1] # New list without first element print(new_arr)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using [:1] returns only the first element, not the rest.
Using [0:] returns the whole list, no deletion.
✗ Incorrect
Slicing with [1:] creates a new list starting from index 1 to the end.
5fill in blank
hardFill both blanks to remove the first element and print the updated list.
DSA Python
arr = [100, 200, 300, 400] arr.[1]([2]) # Remove first element print(arr)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove with an index causes an error.
Adding parentheses inside print incorrectly.
✗ Incorrect
Using pop(0) removes the first element. Printing arr shows the updated list.