PyCodePro

Previously LP16 - A website that teaches Python programming language through interactive tutorials, practice exercises, and real-world projects.

EXPRESSIONS

EXPRESSIONS


EXPRESSIONS
An expression is composed of one or more operations with operators , literals and variables as the constituent of expressions.


Python put it in this way -
In simple words , an atom is something that has a value .

some of these are atoms in python are -
1 - identifiers
2 - literals

And the values in enclosures such as -
1 - quotes ( ' ' )
2 - parenthesis
3 - brackets
4 - strings
5 - tuples
6 - list
7 - dictionaries

Type of Expressions in python are -

1 - arithmetic expression
2 - string expression
3 - relational expression
4 - logical expression
5 - compound expression

NOTE -

1 -the type of operators and operands used in an expression determine the expression types
OR
The operators and operands which is used in expression to determine the expression type.

2 - An expression can be compound expression if it involves multiple types of operators.

let us discuss more about the expressions -

1 - ARITHMETIC EXPRESSIONS

these are the expression which involve numbers ( integers , floating - point numbers , complex numbers ) and arithmetic operators .

2 - RELATIONAL EXPRESSIONS

These are the expression having literals and  / or variables of any valid type and  relational operators are known as relational expression .
for example - x >y , x<=y

3 - LOGICAL EXPRESSIONS

These are the expressions having literals and / or  variables of any valid type and logical operators are known as logical expression .
for example - a or b , b and c , a and not b

4 - STRING EXPRESSIONS

In python there are two types of string expressions plus ( + ) and astric ( * ) .
 when they combined with string operands and integers they form string expressions.

With + operator -  the contenation operator the operand should be a string type only.
for example - "and" + "then"
                         >>> andthen

with * operator - the replication operator the operator should be one string and one integer .
for example - "and" * 2
                         >>>  'andand'

THANKYOU FOR VISITING OUR BLOG


SORRY GUYS I AM NOT ABLE TO UPLOAD THE BLOG FROM SOME DAYS BUT NOW I WILL TRY TO UPLOAD THE BLOG AS EARLIEST.
EXPRESSIONS EXPRESSIONS Reviewed by Learn Python on November 11, 2019 Rating: 5

No comments:

Powered by Blogger.