Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print a message using software instructions.
Intro to Computing
print([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the text.
Using a variable name without defining it.
✗ Incorrect
The print function needs a string inside quotes to display text on the screen.
2fill in blank
mediumComplete the code to assign a number to a variable.
Intro to Computing
speed = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes, making them strings.
Using a function name instead of a value.
✗ Incorrect
Assigning a number to a variable means writing the number without quotes.
3fill in blank
hardFix the error in the code to make the computer add two numbers.
Intro to Computing
result = 5 [1] 3
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using - instead of + causes subtraction.
Using * or / changes the operation.
✗ Incorrect
The plus sign (+) adds two numbers together.
4fill in blank
hardFill both blanks to create a loop that counts from 1 to 5.
Intro to Computing
for [1] in range([2]): print([1] + 1)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using range instead of a variable name.
Using a variable name for range().
✗ Incorrect
The variable i is commonly used in loops. range(5) counts from 0 to 4, so adding 1 prints 1 to 5.
5fill in blank
hardFill all three blanks to create a dictionary of squares for numbers greater than 2.
Intro to Computing
squares = { [1]: [2]**2 for [3] in range(1, 6) if [3] > 2 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names causing errors.
Not using dictionary braces {}.
✗ Incorrect
We use the same variable x for keys and values in the dictionary comprehension.