Complete the code to start the outer loop from the second element in the list.
for i in range([1], len(arr)): key = arr[i] j = i - 1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key
The insertion sort starts from the second element (index 1) because the first element is considered sorted.
Complete the code to compare elements correctly inside the while loop.
while j >= 0 and arr[j] [1] key: arr[j + 1] = arr[j] j -= 1
We move elements that are greater than the key to the right to make space for the key.
Fix the error in the code to insert the key at the correct position after shifting.
arr[j [1] 1] = key
After shifting elements, the key is placed at position j + 1.
Fill both blanks to create a dictionary comprehension that maps each element to its square if the element is less than 5.
{x: x[1]2 for x in arr if x [2] 5}The comprehension squares elements (x ** 2) and filters those less than 5 (x < 5).
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to their values only if the value is positive.
result = [1]: [2] for [3], v in data.items() if v > 0}
v.upper() causes errors because values may not be strings.The comprehension uses k.upper() as keys, v as values, and iterates over k, v.
