1. A variable is something that holds a value that may change. In simplest terms, a variable is a little like a storage box that you can put a value in. In the example below, what is the variable?
2. The output of the following code that contains two variables is 5:
3. In the code below, what is the output?
4. It is possible to assign the value of one variable to be the value of another. Analyse the code below and predict the output. Note that the values of the variables are changing.
red = 5
blue = 10
yellow = red
red = blue
print (yellow, red, blue)
5. Python math works as you would expect it to. If x=2 and y=3, then x+y would give you 5. In the code below, what operators have been used?
6. Python adheres to the PEDMAS or BODMAS order of operations. BODMAS meaning Brackets, Of or Order, Division/Multiplication, Addition/Subtraction. If:
What will the following statement output?
7. Python also has comparison operators which allow you to carry out comparisons.
Complete the table to provide a definition for != (What does it mean?)
< Less than
> Greater than
<= Less than or equal to
8. Name the variables that have been declared below and on what line can you spot an error.
9. Why will the code below fail to run correctly?
10. What is the output of the following code?