Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to store the number 10 in a variable named 'age'.
Python
age = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around 10 makes it a string, not a number.
✗ Incorrect
The variable age stores the number 10 so we can use it later in the program.
2fill in blank
mediumComplete the code to print the value stored in the variable 'name'.
Python
print([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes prints the variable name as text, not its value.
✗ Incorrect
To print the value inside the variable name, just write its name without quotes.
3fill in blank
hardFix the error in the code by completing the assignment of 5 to the variable 'count'.
Python
count [1] 5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '=' causes a syntax error here.
✗ Incorrect
The single equals sign = assigns the value 5 to the variable count.
4fill in blank
hardFill both blanks to create a variable 'total' that adds 3 and 7.
Python
total = [1] [2] 7
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using minus or multiplication changes the result.
✗ Incorrect
The variable total stores the sum of 3 and 7 using the plus sign +.
5fill in blank
hardFill all three blanks to create a variable 'message' that stores 'Hello' repeated 3 times.
Python
message = [1] [2] [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plus
+ concatenates strings, not repeats them.✗ Incorrect
The variable message stores the string 'Hello' repeated 3 times using the * operator.