Complete the code to create an array with 5 elements initialized to zero.
arr = [[1]] * 5 print(arr)
The array is created with 5 zeros because 0 is used as the initial value.
Complete the code to access the third element of the array.
arr = [10, 20, 30, 40, 50] print(arr[[1]])
Array indexing starts at 0, so the third element is at index 2.
Fix the error in the code to correctly update the second element of the array to 99.
arr = [5, 10, 15] arr[[1]] = 99 print(arr)
The second element is at index 1, so arr[1] = 99 updates it correctly.
Fill both blanks to create an array of squares of numbers from 1 to 5.
squares = [x[1]2 for x in range(1, [2])] print(squares)
Using '**' for power and '6' as the range end (exclusive) creates squares from 1 to 5.
Fill both blanks to create a dictionary of numbers and their cubes for numbers greater than 2.
cubes = {x: x{BLANK_2}}3 for x in range(1, 6) if x {{BLANK_2}} 2
print(cubes)Using '{' to start the dictionary, '**' for power, and '>' to filter numbers greater than 2 creates the correct dictionary.