Page 25 - 2501_KVS_C-7
P. 25
Characteristics of Keyword:
1. We can’t use a Keyword as variable name.
2. Keywords are used to define syntax and structure of Python language.
3. Python keywords are case sensitive.
4. Python 3.8 supports 35 such keywords.
Python Keywords: A few keywords are listed below:
False break for import
True None is and
def from if or
Keyword Usage:
Suppose we want to assign False to a variable X:
X = False
Here, False is a keyword used to assign a Boolean false value.
2.4.2 Variable
Variable is just like a small container that can hold a value. A variable is simply a memory
location that is reserved to store some value.
In Python, a variable is created the moment you first assign a value to it.
For example:
X = 8
Here, X is a variable of integer type. In Python, the value assigned to a variable determines
its type.
X = “Computer”
Now, X is a string variable.
Therefore, a variable can change its type after it has been set. X was of integer type in
the first case, while it changed to string type later.
Why do we require variables?
You must have used variables in mathematical expressions. What do they do? If you have
written x = 5 * y, where y = 3, then what will be the value of x? You can see that the value
of x is dependent on the value of y. In this case, x and y are variables.
Now, if the value of y is changed by the user, the value of x automatically changes according
to the new value of y.
In computer programming, you need variables to hold user inputs, intermediate results, and
output.
Python 23

