Expression Statement - One Expression Only

This section provides a quick introduction of expression statement, which is a single expression.

What Is Expression Statement? An expression statement is a simple statement with a single expression. Execution of an expression statement is to evaluate the expression to result a single object.

Expression statements have no statement keyword.

Here are some examples of expression statements:

# an expression statement with a single object
>>> "apple"
'apple'

# an expression statement with a single operation
>>> "pine" + "apple"
'pineapple'

# an expression statement with multiple operations
>>> (9 + 3) * 2 < 10 or (9 + 3) * 2 > 20
True

# an expression statement with a function call
>>> type(3.14)
<class 'float'>

# an expression statement with a tuple object
>>> 9, 1, 1
(9, 1, 1)

# 3 expression statements written in 1 line
>>> 9; 1; 1;
9
1
1

Table of Contents

 About This Book

 Running Python Code Online

 Python on macOS Computers

 Python on Linux Computers

 Built-in Data Types

 Variables, Operations and Expressions

Statements - Execution Units

 What Is Statement

 "pass" Statement - Do Nothing Statement

Expression Statement - One Expression Only

 "=" Statement - Assignment Statement

 "del" Statement - Delete Statement

 "import" Statement to Load Modules

 "if" Statement for Conditional Execution

 "while" Statement for Execution Loop

 "for" Statement for Iterative Execution

 "try" Statement to Catch Execution

 "with" Statement for Context Manager

 "match" Statement for Pattern Match

 Function Statement and Function Call

 Iterators, Generators and List Comprehensions

 Classes and Instances

 Modules and Module Files

 Packages and Package Directories

 "sys" and "os" Modules

 "pathlib" - Object-Oriented Filesystem Paths

 "pip" - Package Installer for Python

 SciPy.org - Python Libraries for Science

 pandas - Data Analysis and Manipulation

 Anaconda - Python Environment Manager

 Jupyter Notebook and JupyterLab

 References

 Full Version in PDF/EPUB