0
0
Pythonprogramming~10 mins

Why operators are needed in Python - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add two numbers and print the result.

Python
result = 5 [1] 3
print(result)
Drag options to blanks, or click blank then click option'
A/
B-
C+
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or multiplication instead of addition.
2fill in blank
medium

Complete the code to check if 10 is greater than 7.

Python
if 10 [1] 7:
    print("10 is greater")
Drag options to blanks, or click blank then click option'
A>
B<=
C==
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than or equal instead of greater than.
3fill in blank
hard

Fix the error in the code to multiply two numbers correctly.

Python
product = 4 [1] 6
print(product)
Drag options to blanks, or click blank then click option'
A*
B-
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using plus or minus instead of multiplication.
4fill in blank
hard

Fill both blanks to create a dictionary of squares for numbers greater than 3.

Python
squares = {x: x[1]2 for x in range(1, 6) if x [2] 3 }
Drag options to blanks, or click blank then click option'
A**
B%
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using modulo instead of power, or less than instead of greater than.
5fill in blank
hard

Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.

Python
result = { [1]: [2] for k, v in data.items() if v [3] 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase keys or wrong comparison operators.