Complete the code to calculate the square of 4.
result = 4 [1] 2 print(result)
The ** operator is used to raise a number to the power of another number. Here, 4 squared is 42.
Complete the code to find the remainder when 17 is divided by 5.
remainder = 17 [1] 5 print(remainder)
The % operator gives the remainder of division. 17 % 5 equals 2.
Fix the error in the code to calculate the integer division of 15 by 4.
result = 15 [1] 4 print(result)
The // operator performs integer division, giving the quotient without the remainder. 15 // 4 equals 3.
Fill both blanks to create a dictionary of squares for numbers 1 to 5, but only include squares greater than 10.
squares = {x: x[1]2 for x in range(1, 6) if x[1]2[2]10}
print(squares)Use ** to square the number and > to filter squares greater than 10.
Fill all three blanks to create a dictionary with uppercase keys, values as numbers, and only include values greater than 2.
result = [1]: [2] for [3], [2] in {'a':1, 'b':3, 'c':5}.items() if [2] > 2} print(result)
Use k.upper() for uppercase keys, v for values, and k as the key variable in the loop.