Computer Python 2 Datatypes&Variables
Computer Python 2 Datatypes&Variables
Learning Objective:
Variables in
Python
Identify the rules for writing valid variable name and create
programs using it
Variables in
Python
Identify the rules for writing valid variable name and create
programs using it
Rules for naming a
variable
• A variable name must start with a letter or underscore.
• A variable name cannot start with a number.
• Variable names are case-sensitive (age, Age and AGE are
three different variables)
• Variable name can be of any length.
• No special symbols allowed in variable name
• It can be the combination of lowercase letter(a-z),upper case
letter(A-Z),digits(0-9) and underscore(_).
• Keywords cannot be used as variables.
Assigning values to
variable
• Storing a value in memory and the operator is (=).
• For example:
A=“IHS”
print(A)