Recall & Review
beginner
What is variable assignment in Python?
Variable assignment means giving a name to a value so you can use it later. For example,
x = 5 means the name x now holds the value 5.Click to reveal answer
beginner
How do you assign multiple variables in one line in Python?
You can assign multiple variables by separating them with commas. For example,
a, b = 1, 2 assigns 1 to a and 2 to b.Click to reveal answer
beginner
What happens if you assign a new value to an existing variable?
The old value is replaced by the new one. For example, if
x = 5 and then x = 10, x now holds 10.Click to reveal answer
beginner
Can variable names in Python start with a number?
No, variable names cannot start with a number. They must start with a letter (a-z, A-Z) or an underscore (_).
Click to reveal answer
beginner
What is the difference between
= and == in Python?= is used to assign a value to a variable. == is used to check if two values are equal.Click to reveal answer
Which of the following is a valid variable assignment in Python?
✗ Incorrect
Option A correctly assigns 100 to the variable 'score'. Option B tries to assign to a number, which is invalid. Option C is a comparison, not assignment. Option D uses walrus operator which is valid in expressions but not for simple assignment statements.
What will be the value of 'a' after this code? <br>
a = 5<br>a = 10✗ Incorrect
The second assignment replaces the first, so 'a' holds 10.
Which variable name is NOT valid in Python?
✗ Incorrect
Variable names cannot start with a number, so '2ndValue' is invalid.
How do you assign the values 1, 2, and 3 to variables x, y, and z in one line?
✗ Incorrect
Option B correctly assigns 1 to x, 2 to y, and 3 to z in one line.
What does the '=' symbol do in Python?
✗ Incorrect
'=' assigns the value on the right to the variable on the left.
Explain how to assign a value to a variable in Python and what rules variable names must follow.
Think about how you give a name to a box and put something inside.
You got /2 concepts.
Describe what happens when you assign a new value to an existing variable.
Imagine replacing the content inside a labeled box.
You got /3 concepts.