DATATYPES , VARIABLES & IDENTIFIERS - PYTHON PROGRAMMING
Variables and Identifiers
A variable is an alternate name given to some memory locations.
It allows us to store and manipulate data in our programs. In
Python, we can assign values to variables and update them as
needed. An identifier, on the other hand, is used to identify
elements such as variables, classes, functions, etc. We give
names to these elements so that we can easily identify and work
with them.
Rules for Naming Variables and Identifiers
The name should not match any Python keyword.
The name can consist of alphabets or numerals.
The name should start with a character or an
underscore.
The name can be alphanumeric, but it should start
with a character or an underscore.
The name is case-sensitive, so "name" and "Name"
are considered different variables.
Data Types
In Python, we have different data types to represent different
kinds of values. The two main categories are numbers and
strings.
Numbers
Numbers can be integers, floating-point numbers, or complex
numbers. In Python, we can assign values to variables without
explicitly declaring their data types. For example, j = 5 assigns
the value 5 to the variable j, which is automatically considered
an integer. We can perform arithmetic operations on these
numbers just like in other programming languages.
Variables and Identifiers
A variable is an alternate name given to some memory locations.
It allows us to store and manipulate data in our programs. In
Python, we can assign values to variables and update them as
needed. An identifier, on the other hand, is used to identify
elements such as variables, classes, functions, etc. We give
names to these elements so that we can easily identify and work
with them.
Rules for Naming Variables and Identifiers
The name should not match any Python keyword.
The name can consist of alphabets or numerals.
The name should start with a character or an
underscore.
The name can be alphanumeric, but it should start
with a character or an underscore.
The name is case-sensitive, so "name" and "Name"
are considered different variables.
Data Types
In Python, we have different data types to represent different
kinds of values. The two main categories are numbers and
strings.
Numbers
Numbers can be integers, floating-point numbers, or complex
numbers. In Python, we can assign values to variables without
explicitly declaring their data types. For example, j = 5 assigns
the value 5 to the variable j, which is automatically considered
an integer. We can perform arithmetic operations on these
numbers just like in other programming languages.