Difference between Python Expression and Statement
In this tutorial, we will learn the differences between Python expressions and statements.
Expressions vs Statements
Some of the differences are as follows:
Python Expressions |
Python Statements |
Python expression is a combination of literals, variables, and function calls that evaluates to a value. | A Python statement is an instruction the Python interpreter executes and does some action. |
Python interpreter evaluates the expression. | Python interpreter executes the statement. |
Python expression evaluates to a value. We generally print or assign the expression to a variable. | Python statements result in an action or some side effect. |
Python expression example:
/> 7 + 9 |
Python statement example:
/> sum = 7 + 9 |
—
Python Tutorials
Python Tutorial on this website can be found at:
https://www.testingdocs.com/python-tutorials/
More information on Python is available at the official website: