Complete the code to create an array with 5 elements.
arr = [[1]]The array is created by listing elements separated by commas inside square brackets.
Complete the code to add a new node with value 10 at the start of a linked list.
new_node = Node(10) new_node.next = [1] head = new_node
To insert at the start, new_node.next should point to the current head.
Fix the error in the code to remove the last element from an array.
arr = [1, 2, 3, 4, 5] arr.[1]()
pop() without arguments removes the last element from the list.
Fill both blanks to traverse a linked list and print each node's value.
current = head while current [1] None: print(current.[2]) current = current.next
We check if current is not None to continue traversal and print the value attribute of the node.
Fill all three blanks to create a dictionary comprehension that maps each word to its length if length is greater than 3.
{ [1]: [2] for [3] in words if len([3]) > 3 }The comprehension maps each word to its length for words longer than 3 characters.