Knowledge Base‎ > ‎Programming‎ > ‎Python‎ > ‎Python Reference‎ > ‎

integer


Related:

 Examples

 
 
age = 16

 Description        

 
Creates a variable which is an integer. Integers are numbers with no decimal. 

Note: when dividing integers the result (in Python 2.x) is always an integer. See the interpreter session below.

 Syntax

 
 
name = value

 Parameters

 
name - a legal variable name 

value - the value to store in the variable, in this case an integer

 Interpreter

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> age = 16

>>> type(age)

<type 'int'>

>>> age

16

>>> age / 2

8

>>> age / 3

5

>>>




Comments