CHAPTER 5
Working with Python’s Operators
Python provides a wide range of operators for performing operations on values and variables. You use arithmetic operators to perform mathematics, assignment operators to assign data to variables, comparison operators to make comparisons, and logical operators to link conditional statements. You use identity operators to test whether objects are identical, membership operators to determine whether an object includes a particular value, and bitwise operators to compare and manipulate binary numbers.

Work with the Arithmetic Operators
Work with the Assignment Operators
Work with the Comparison Operators
Work with the Logical Operators
Work with the Identity Operators
Meet the Arithmetic Operators
When you need to perform arithmetical operations in Python, such as addition or division, you can use standard arithmetic operators, adapted slightly for the computer keyboard. For example, while the keyboard includes the + key for addition, it has no ÷ key for division, so you use for division instead.
Python performs operations following the standard order used in mathematics. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access