1. Technology

Beginning Python: Data Types

By

2 of 10

Integers

An integer in Python, also known as a 'numeric literal', is simply a name used for a numeric value. For this reason, these values are commonly called integers even if they are assigned the value of a real number in the form of an integer and a decimal value. Any numeric value can be assigned to it at any time, overwriting the previous value.

To assign a value to an integer variable, one writes a statement after the following template:

 <numeric literal name> = <numeric literal value> 

Some examples are:

 x = 1500 
 pi = 3.14 
  1. About.com
  2. Technology
  3. Python

©2014 About.com. All rights reserved.