Table of Operator Order

*Quick but important post

Below is a list of the order that one should follow when looking at Python’s Operators. The list goes from the first to last precedence

  1. **                                                                            = exponentiation

  2. ~  +  –                             = complement, unary plus and minus

  3. *   /   %   //      = multiply, divide, modulus, and floor division

  4. +   –                                                    = addition and subtraction

  5. >>   <<                                             = right and left bitwise shift

  6. &                                                                          = bitwise ‘AND’

  7. ^|                            = bitwise exclusive ‘OR’ and regular ‘OR’

  8. <=   <    >    >=                                               = comparison operators

  9. =   %=   /=   //=   -=   +=   *=   **=       = assignment operators

  10. is is not                                                          = identity operators

  11. in not in                                                    = memberships operators

  12. not or and                                                      = logical operators

Some of these operators may not make much sense now however when we go into depth into different operators this table will be incredibly helpful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s