Python – Variables and Data types:


A variable is the location in the memory to store the values. A variable may hold different types of values like numbers, strings etc. In Python, no need to declare a datatype for a variable.It will understand by the value that is assigned to the variable.

The name of variable or a function that we define can be called as Identifier. An Identifier must obey the below rules.

Identifiers can have letters, digits, underscores.

There is no definite in length.

All identifiers must start with letter or underscore. You cannot use digits.

Identifier should not be a keyword. (which is a reserved word for python)

Examples of value assignment to a variable:

Data Types:

Python has different types of datatypes as below.