Python
  Home arrow Python arrow Python: Count on It
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? 
Google.com  
PYTHON

Python: Count on It
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    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:
      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: 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
     

       

    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 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek