This presentation informs you on the Python programme components by discussing Expressions in Python and its operators with token, Escape sequence in python.
2. Components of any Python Program are as below:-
Components of Python Program
Python
Suite
Comments
Statement
Blocks and
Indentations
Literals
Constants
Identifiers
Variables
reserved
words
Expression
3. An expression is a combination of values, variables,
operators and call-to-functions.
Expressions need to be evaluated.
If you use print function for an expression then it
evaluates the expressions and prints the result.
Expression generally evaluates to a value, which is why
expression is written on the right hand side in an
assignment statement.
A single value itself is a simple expression.
Expressions in Python
4. Python expressions only contain identifiers,
literals, and operators. some of those operators
are:-
Token
Operator
How to create an expression?
add
subtract
multiply
power
Integer Division
remainder
decorator
+
-
*
**
/
%
@
5. An escape sequence consists of a special
character, such as backslash(), followed by a
required character.
Whitespace is represented by these characters.
Whitespace gives characters like space, tab,
formfeed, vertical tab.
Escape sequence in python
6. Few important escape sequences are mentioned
as below:-
Escape sequence Escape sequence
n
t
v
1.
2.
3.
4.
5.
6.
write a single line string
into multi line string
To print
new line
Horizontal tab
Vertical tab
Escape sequence in python
7. Data Types in Python
Mutable vs Immutable Data
type in Python
Stay Tuned with
Topics for next Post