## Arithmetic Operators

Python includes the +, -, *, /, % (modulus), and ** (exponentiation) operators

Assume variable a holds 10 and variable b holds 20 then:Operator Description Example+ Addition a + b will give 30 - Subtraction b will give -10 * Multiplication a * b will give 200 / Division b / a will give 2 % Modulus b % a will give 0 ** Exponent a**b will give 10 to the power 20 // Floor Division 9//2 is equal to 4 and 9.0//2.0 is equal to 4.0

## Comparison Operators

The basic comparison operators such as ==, <, >=, and so forth are used on all manner of values. Numbers, strings, sequences, and mappings can all be compared.

The following table shows a list of comparison operators.Operator Description< less than <= less than or equal == equal > greater than >= greater than or equal != not equal <> not equal

## Logical Operators

The logical operators and and or also return a Boolean value when used in a decision structure. There are three logical operators: and, or, and not. For example, x > 0 and x < 10 is true only if x is greater than 0 and less than 10Operator Descriptionand logical AND or logical OR not logical NOT

### Recommended Python Training – Treehouse

For Python training, our top recommendation is Treehouse.

Treehouse is an online training service that teaches web design, web development and app development with videos, quizzes and interactive coding exercises.

Treehouse has beginner to advanced Python training that programmers of all levels benefit from.

Read more about:

Mahan MarwatJan. 23, 2014, 12:15 p.m.Landon SandersDec. 11, 2013, 8:57 a.m.