Home arrow Python arrow Python: Count on It

Python: Count on It

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.

  1. Python: Count on It
  2. Decimals, Division, and Floats
  3. Floating Points
  4. Built-in Math Functions
By: James Payne
Rating: starstarstarstarstar / 3
February 19, 2008

print this article



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


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

>>> num=2147483648

>>> num*1


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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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: