0
0
DSA Pythonprogramming~10 mins

Array Insertion at Beginning in DSA Python - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to insert an element at the beginning of the list.

DSA Python
arr = [2, 3, 4]
arr.[1](0, 1)
print(arr)
Drag options to blanks, or click blank then click option'
Ainsert
Bextend
Cpop
Dappend
Attempts:
3 left
💡 Hint
Common Mistakes
Using append adds at the end, not the beginning.
Using pop removes elements instead of adding.
2fill in blank
medium

Complete the code to insert the value 10 at the start of the list named numbers.

DSA Python
numbers = [20, 30, 40]
numbers.[1](0, 10)
print(numbers)
Drag options to blanks, or click blank then click option'
Apop
Bappend
Cremove
Dinsert
Attempts:
3 left
💡 Hint
Common Mistakes
Using append adds at the end.
Using remove or pop deletes elements.
3fill in blank
hard

Fix the error in the code to correctly insert 5 at the beginning of the list.

DSA Python
data = [6, 7, 8]
data.[1](0, 5)
print(data)
Drag options to blanks, or click blank then click option'
Aappend
Binsert
Cextend
Dpop
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of arguments causes wrong insertion.
Using append adds at the end.
4fill in blank
hard

Fill both blanks to insert 100 at the start and then print the list.

DSA Python
lst = [200, 300]
lst.[1]([2], 100)
print(lst)
Drag options to blanks, or click blank then click option'
Ainsert
Bappend
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using append instead of insert.
Using wrong index like 1 instead of 0.
5fill in blank
hard

Fill all three blanks to insert 0 at the beginning, then insert 5 at index 1, and finally print the list.

DSA Python
arr = [10, 15]
arr.[1]([2], 0)
arr.[3](1, 5)
print(arr)
Drag options to blanks, or click blank then click option'
Ainsert
Bappend
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using append instead of insert.
Mixing up indices.