Data Types In Python Tccicomputercoaching.Com

Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. Python is a multi-paradigm programming language: object-oriented programming and structured programming are fully supported,

Data types determine whether an object can do something, or whether it just would not make sense.

Variable stores the value of data, variable means nothing but memory location where we can store the data. But this data can be any type like only alphabets or letters, digits, real numbers or mixed types. Compiler can’t differentiate these data, so, in programming language we have to use Data Type to differentiate data as per their type. For example if only 0 to 9 digit then its integer type, if real number then its float type.

Python has five standard data types −






Built-in Data types:

Python’s built-in (or standard) data types can be grouped into several classes. Sticking to the hierarchy scheme used in the official Python documentation these are numeric types, sequences, sets and mappings (and a few more not discussed further here). Some of the types are only available in certain versions of the language as noted below.

Numeric types:

int: Integers; equivalent to C longs in Python 2.x, non-limited length in Python 3.x

long: Long integers of non-limited length; exists only in Python 2.x

float: Floating-Point numbers, equivalent to C doubles

complex: Complex Numbers


str: String; represented as a sequence of 8-bit characters in Python 2.x, but as a sequence of Unicode characters (in the range of U+0000 – U+10FFFF) in Python 3.x

byte: a sequence of integers in the range of 0-255; only available in Python 3.x

byte array: like bytes, but mutable (see below); only available in Python 3.x



Python Lists

Lists are the most versatile of Python’s compound data types. A list contains items separated by commas and enclosed within square brackets ([]). To some extent, lists are similar to arrays in C. One difference between them is that all the items belonging to a list can be of different data type.

Python Tuples

A tuple is another sequence data type that is similar to the list. A tuple consists of a number of values separated by commas. Unlike lists, however, tuples are enclosed within parentheses.

The main differences between lists and tuples are: Lists are enclosed in brackets ([]) and their elements and size can be changed, while tuples are enclosed in parentheses (()) and cannot be updated.

Python Dictionary

Python’s dictionaries are kind of hash table type. They work like associative arrays or hashes found in Perl and consist of key-value pairs. A dictionary key can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object.

Call now 9825618292

Mail to

Get information from

For more information About Python Course, TCCI


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s