Python
  Home arrow Python arrow Python: Count on It
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 
eWeek
 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: Count on It
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-02-19

    Table of Contents:
  • Python: Count on It
  • Decimals, Division, and Floats
  • Floating Points
  • Built-in Math Functions

  • 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

    Speeding Shipping, Improving Compliance – Read the ScanCode Systems Case Study

    Python: Count on It
    (Page 1 of 4 )

    We touched on how numbers work in Python a while back in the beginning of our series on Python. In the past few tutorials we discussed strings and how to manipulate them and some of the string methods. Here, in this article, we will go over some of the math modules and discuss different uses for numbers in Python.

    Intergalactic Integers Intentionally Invaded Iraq Intent on Infiltrating Its Islamic Oil

    Yeah you heard me. Try saying that headline three times fast. Or even slow. Although I am sure there is a way we could do just that with our Python integers, it won't be the focus of today's article. Instead we will cover more fascinating subjects, like explaining why our buddy Python has two types of integers. Shocking, I know.

    As you know, integers are whole numbers, both positive and negative, that do not have a value to the right of the decimal point. There are two kinds of integers in Python: regular and long.

    The reason for the two types of integers is that computers handle data larger than 32 bytes by assigning the suffix L to the end of the integer. Any number less than 2,147,483,647 is considered a regular integer; anything larger is a long integer. To see an example of what I mean, type the following at your command prompt:


    >>> num=2147483647

    >>> num*1

    2147483647

    Now to see a long, we are going to add one to our number:


    >>> num=2147483648

    >>> num*1

    2147483648L

    More Python Articles
    More By James Payne


       · Hey, thanks for stopping by. In this article we cover math in Python, including such...
     

       

    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