WorksheetsPython Mod 2 Sec 4
Total questions: 15
Worksheet time: 10mins
A variable in Python is:
a fixed value that cannot be changed
a container for storing data values
a type of loop
a function
Which of the following is a legal identifier for a variable in Python?
1variable
_variable
variable-1
variable@
Fill in the blank: Python is a ______-typed language, which means you don't need to declare variables in it.
dynamically
statically
strongly
weakly
What is the output of the following code? var = 2 print(var)
2
var
print(var)
Error
How can you combine text and variables in Python?
By using the '+' operator
By using the ',' operator
By using the '%' operator
By using the 'format()' method
What is the variable in the code shown
variable
Name
name
What will be the output of the following code? ```python x = 10 y = 5 print(x - y) ```
`5`
`15`
`10`
`Error`
What will be the output of the following code? ```python x = 10 y = 5 print(x + y) ```
`15`
`10`
`5`
`Error`
What will be the output of the following code?
x = 10
y = 5
print(x - y)
5
15
10
Error
What is the output of the following Python code?
x = 5
y = 10
print(x * y)
50
15
5
10
What will be the output of the following code?
x = 10
y = 5
print(x - y)
5
15
10
Error
What is the output of the following code? ```python x = 5 y = 10 print(x * y) ```
`50`
`15`
`5`
`10`
In Python, a variable needs to
start with letter not number
be stated before "print"
have % symbols on either side
Variable????? We don't need variables!!!!
What is the output of the following code?
x = 5
y = 10
print(x * y)
50
15
5
10
What is the variable in the code shown
variable
Name
name
