Python Data Types

Python supports two basic data types: Numbers and Strings:

Numbers

Strings

 

Numbers

Python supports four numeric types that all are immutable:

Integer

>>> a = 10 >>> b = 20 >>> a * b 200

Long Integer

Float

>>> a = 2.5 >>> b = 1.5 >>> a / b 1.6666666666666667

Complex

>>> x = 1 + 2j >>> x.real 1.0 >>> x.imag 2.0

Leave a Reply

Your email address will not be published. Required fields are marked *