NEW
Font size
WorksheetsVariables
Total questions: 10
Worksheet time: 8mins
What are the rules for naming a variable in Python?
Variables in Python can only contain letters, numbers, and underscores. They cannot start with a number and cannot be a Python keyword.
Variables in Python can start with a number
Variables in Python can contain any special characters
Variables in Python can be named after Python keywords
After run the following code, x = -------------
12
2
14
24
If I want to store my height in a variable, which of the following would be a good variable name in best practice?
abcdefg
inches
number
height
How do you declare a variable in Python?
variable_name = value
value = variable_name
variable = value_name
name = variable_value
---------------------- is a reference to a location in memory where the data is stored.
Variable
python
Vakue
Operators
After run the following code, x = -------------
12
15
36
1728
After run the following code , the output will be -----------------
test
exam
testexam
z
print(Hello world!)
If I want to store my name in a variable, which of the following would be a good variable name in best practice?
name
teacher
mister
abcdef
