First page Back Continue Last page Overview Graphics

Number Data Types and Literals

Python2:

Integers normal Integers , like 42, 4321 0 as a prefix: Octal number and 0x means Hex number

Long Integer If an integer literal ends with an l or L, it becomes a Python long integer. It can grow as “long” as needed. Since Python 2.2. the letter “l” or “L” is no longer needed, as integers are automatically converted to long integers on overflow. In Python 3: only Integers!

Floating-point numbers numbers like 3.14159 or 17.3e+02

complex numbers e.g. 1.2+3j

Python3:

Integers No long int anymore, but int “contains” long int

Floating-point numbers

complex numbers