Complete the code to print numbers from 1 to 5 using a loop.
for i in range(1, [1]): print(i)
The range function stops before the end number, so to print 1 to 5, we use 6 as the stop.
Complete the code to stop the loop when i equals 3.
for i in range(1, 6): if i == [1]: break print(i)
The break stops the loop when i is 3, so numbers 1 and 2 print only.
Fix the error in the loop to skip printing number 3.
for i in range(1, 6): if i == [1]: continue print(i)
The continue skips the current loop when i is 3, so 3 is not printed.
Fill both blanks to create a dictionary of squares for numbers greater than 2.
squares = {x: x[1]2 for x in range(1, 6) if x [2] 2}Use ** to square numbers and > to filter numbers greater than 2.
Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.
result = [1]: [2] for k, v in data.items() if v [3] 0}
Keys are converted to uppercase with k.upper(), values are v, and filter keeps values greater than 0.
