Complete the code to print the value of variable count.
count = 5 print([1])
The variable count holds the value 5. To print it, use print(count). The other options are misspelled or undefined variables.
Complete the code to fix the syntax error in the if statement.
number = 10 if number [1] 5: print("Greater than 5")
= instead of comparison operators.== with greater than >.The if statement needs a comparison operator. > checks if number is greater than 5. Using = causes a syntax error because it is an assignment, not a comparison.
Fix the error in the loop to correctly print numbers from 0 to 4.
for i in range([1]): print(i)
The range(5) generates numbers 0 to 4. Using 4 would generate 0 to 3, missing 4. Using 5 is correct to include 4.
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}* instead of ** for squaring.< instead of > in the condition.The expression x**2 calculates the square of x. The condition x > 2 filters numbers greater than 2. Other options either calculate incorrectly or filter wrong numbers.
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}
k instead of k.upper() for keys.< or == instead of > in condition.k.upper() converts keys to uppercase. v is the value. The condition v > 0 filters values greater than zero. This creates a dictionary with uppercase keys and positive values.