Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if the input number is positive.
Agentic AI
if number [1] 0: print("Positive number")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' will check for negative numbers.
Using '==' checks only if the number equals zero.
✗ Incorrect
The condition 'number > 0' checks if the number is positive.
2fill in blank
mediumComplete the code to print 'Even' if the number is divisible by 2.
Agentic AI
if number [1] 2 == 0: print("Even")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '**' operators will cause errors or wrong logic.
Using '//' gives the quotient, not the remainder.
✗ Incorrect
The modulus operator '%' gives the remainder. If remainder is 0, number is divisible by 2.
3fill in blank
hardFix the error in the condition to check if age is between 18 and 30.
Agentic AI
if 18 [1] age [2] 30: print("Eligible")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' reverses the logic.
Using '>=' or '<=' changes the range to include boundaries.
✗ Incorrect
The correct condition is '18 < age < 30' to check if age is strictly between 18 and 30.
4fill in blank
hardFill both blanks to create a dictionary of words with length greater than 3.
Agentic AI
{word: len(word) for word in words if len(word) [1] 3 and word [2] 'test'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or '==' in the first blank changes the length condition.
Using '==' in the second blank includes 'test' instead of excluding it.
✗ Incorrect
We want words longer than 3 and not equal to 'test'. So use '>' and '!='.
5fill in blank
hardFill all three blanks to filter a dictionary with keys starting with 'a' and values greater than 10.
Agentic AI
{k: v for k, v in data.items() if k[1]'a') and v [2] 10 and isinstance(v, [3])} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '.startswith(' causes errors.
Using '==' instead of '>' changes the value condition.
Using wrong type instead of 'int' causes type check failure.
✗ Incorrect
Use 'k.startswith('a')' to check keys, 'v > 10' for values, and 'int' to check type.