Python
  Home arrow Python arrow Python Operators
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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: 5 stars5 stars5 stars5 stars5 stars / 2
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Dell PowerEdge Servers

    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


       · Thanks for stopping by and reading my article on Python Operators. Here we discuss...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway