0
0
Pythonprogramming~10 mins

Why variables 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 store the number 10 in a variable named 'age'.

Python
age = [1]
Drag options to blanks, or click blank then click option'
Aage
B'age'
C10
Dten
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around 10 makes it a string, not a number.
2fill in blank
medium

Complete the code to print the value stored in the variable 'name'.

Python
print([1])
Drag options to blanks, or click blank then click option'
AName
Bname
Cprint
D'name'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes prints the variable name as text, not its value.
3fill in blank
hard

Fix 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'
A=
B==
C===
D:=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '=' causes a syntax error here.
4fill in blank
hard

Fill 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'
A3
B+
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using minus or multiplication changes the result.
5fill in blank
hard

Fill 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'
A'Hello'
B*
C3
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using plus + concatenates strings, not repeats them.