Home arrow Python arrow Python Operators

Python Operators

In the previous two articles on Python, I promised to tell you about Operators, but I lied. Instead I covered such things as conditionals, sets, lists, dictionaries, and so forth. Now, at last, I am going to cover the various operators that Python has to offer, and force you, I mean teach you, to manipulate data with them.

TABLE OF CONTENTS:
  1. Python Operators
  2. The Prestigious Mathematical Operators
  3. The Judgmental Comparison Operators
  4. Boolean is Not a Type of Broth
  5. Assignment Operators
By: James Payne
Rating: starstarstarstarstar / 8
January 14, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

But first, since you've no doubt been busy and the last part of this Python series went live in early December of last year, here is a view of the available operators:

 

Symbol

Type

What it Does

+

Mathematical

Addition

-

Mathematical

Subtraction

*

Mathematical

Multiplication

/

Mathematical

Division

//

Mathematical

Truncating Division

**

Mathematical

Powers

%

Modulos

Returns the remainder from a division

<<

Shift

Left Shift

>>

Shift

Right Shift

&

Logical

And

|

Logical

Or

^

Logical

Bitwise XOR

~

Logical

Bitwise Negation

<

Comparison

Less than

>

Comparison

Greater than

'=='

Comparison

Equal to

!=

Comparison

Not Equal To

>=

Comparison

Greater than or Equal To

<=

Comparison

Less than or Equal To

'='

Assignment

Assigns a value

+=

Assignment

Adds and assigns a value

-=

Assignment

Subtracts and Assigns a value

*=

Assignment

Multiplies and assigns a value

/=

Assignment

Divides and assigns a value

//=

Assignment

Truncate Divides and assigns a value

**=

Assignment

Powers and assigns

%=

Assignment

Modulus and assigns

>>

Assignment

Shifts and assigns

<<

Assignment

Shifts and assigns

And

Boolean


Or

Boolean


Not

Boolean




 
 
>>> More Python Articles          >>> More By James Payne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: