Expressions
Expression contains of identifiers, literals and operators. It is a
combination of values, variables and operators. It consists of operators
and operand. If there are more than one operator present in a expression
the precedence decide which operation will be performed first. There are
many types of expression available in python.
Types of Expressions
- Constant Expression
- Arithmetic Expression
- Integral Expression
- Floating Expression
- Relational Expression
- Logical Expression
- Bitwise Expression
- Combinational Expression
Constant Expression:
In constant expression it contains
only constant values.
Example:
X= 15+1.3
Arithmetic Expression:
The arithmetic expression contains all arithmetic operators.
Example: Addition
Subtraction
Multiplication
Division
Exponent
Integral Expression:
In this type of expression
it produces only the integer values as result.
Example: 25
Floating Expression:
In this type of expression it produces only floating point number as
result.
Example: 2.6
Relational Expression:
In this type of expression
,arithmetic expressions are written on both sides of relational
operator. Those arithmetic operators are evaluated first compared
to the relational operator and produce a boolean output.
Example: True
False
Logical Expression:
In this type of expression
the outcome is in boolean values. It specifies one or more
conditions.
Example: False
True
False
Bitwise Expression:
In this type of expression
the computations are performed at bit level.
Example: 3 24
Combinational Expression:
In this type of expression different
types of expressions are performed on a single expression.
More topic in Python