Title: Components of a python program (part 3)
1Components of Python Program
Swipe
2Components of Python Program
Components of any Python Program are as below-
Suite
Literals
Comments
Constants
Python
Statement
Identifiers
Variables
Expression
Blocks and Indentations
reserved words
3Expressions in Python
An expression is a combination of values,
variables, operators and call-to-functions. Expr
essions 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.
4How to create an expression?
Python expressions only contain identifiers,
literals, and operators. some of those operators
are-
Token
Operator
add subtract multiply power Integer Division
remainder decorator
-
/ _at_
5Escape sequence in python
- 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.
6Escape sequence in python
Few important escape sequences are mentioned as
below-
Escape sequence
Escape sequence
\
1. 2. 3. 4. 5. 6.
write a single line string into multi line string
To print \ new line Horizontal tab Vertical tab
\\ \n \t \v
7Topics for next Post
Data Types in Python Mutable vs Immutable Data
type in Python Stay Tuned with