## Mathematical operators

**We’ve explored writing and running a program that does a calculation.**

Now, let’s look at the list of operators below used to perform mathematical operations.

**or logical OR**

**and logical AND**

**not logical NOT**

**< <= > >= comparison operators**

**== != equality operators**

**is object identity test**

**in object membership test**

**| ^ binary OR, XOR**

**& binary AND**

**<< >> binary shift**

**- + subtract, add**

*** / // % multiply, divide, integer-divide, modulo**

**@ matrix multiplication (3.5)**

**~ ** complement, exponentiation**

**await await expression (3.5)**

Note that:

- The operators are listed in reverse order of precedence (‘or’ is the lowest precedence)
- The difference between / and // is best shown as an example:
- x = 2
- y = x/3 gives 0.666666666667
- y = x//3 gives 0

- Await is used with coroutines and becomes a keyword in 3.7, along with async. Both were introduced at 3.5 and require the asyncio module. This module is current provisional and may include changes that are not backward compatible.
- The @ operator (matmul) is intended for matrix multiplication and has the same precedence as multiplication. No built-in types currently support this operator; it is intended for third-party modules.

In the next video, Sarah will show you how to write a short programme that requires some external input and certain calculations to produce an output.

In this section, you will explore data types, variables, input and output functions, and discover more about calculations and mathematical operators in Python.

A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.