Data Types in Python

In computer programming each variable has an associated data type. Data types specify the type of data that can be stored inside a variable.

Data Types

Since everything is an object in Python programming, data types are actually classes and variables are instances(object) of these classes.

Data Types Classes Description
Numeric int, float, complex holds numeric values
String str holds sequence of characters
Sequence list, tuple, range holds collection of items
Mapping dict holds data in key-value pair form
Boolean bool holds either True or False
Set set, frozeenset hold collection of unique items

Variable

Variable is a location in computer memory where data is temporary stored OR saved.

How to use

e.g: rollNumber = 13

Explanation
rollNumber is Name of variable
13 is Value of variable

Another Example

e.g: floatingVariable = 5.67

Explanation
floatingVariable is Name of variable
5.67 is Value of variable

Special Characters
Character Use for ASCII
\n OR endl Newline 10
\t Horizontal tab 9
\v Vertical tab 11
\b Backspace 8
\r Carriage return 13
\f Formfeed 12
\a Alert 7
\\ Backslash 92
\? Question mark 63
\' Single quotation mark 39
\" Double quotation mark 34
\ooo Octal number --
\xhhh Hexadecimal number --
\0 Null character 0