Python
  Home arrow Python arrow Python Operators
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Python Operators
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2008-01-14


    Table of Contents:
  • Python Operators
  • The Prestigious Mathematical Operators
  • The Judgmental Comparison Operators
  • Boolean is Not a Type of Broth
  • Assignment Operators

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Python Operators
    ( Page 1 of 5 )

    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.

    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
     

       

    PYTHON ARTICLES

    - 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
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT