Expressions only contain identifiers, literals and operators, where operators include arithmetic and boolean operators, the function call operator ()

What is the difference between an expression and a statement in Python?

submited by
Style Pass
2021-06-09 09:00:04

Expressions only contain identifiers, literals and operators, where operators include arithmetic and boolean operators, the function call operator () the subscription operator [] and similar, and can be reduced to some kind of "value", which can be any Python object. Examples:

Statements (see 1, 2), on the other hand, are everything that can make up a line (or several lines) of Python code. Note that expressions are statements as well. Examples:

expression: Mathematics a collection of symbols that jointly express a quantity : the expression for the circumference of a circle is 2πr.

In Python, expressions are covered extensively in the Python Language Reference In general, expressions in Python are composed of a syntactically legal combination of Atoms, Primaries and Operators.

Literals and syntactically correct combinations with Operators and built-in functions or the call of a user-written functions:

Leave a Comment