In computer programming each variable has an associated data type. Data types specify the type of data that can be stored inside a variable.
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 is a location in computer memory where data is temporary stored OR saved.
How to use
e.g: rollNumber = 13
| rollNumber | is Name of variable |
|---|---|
| 13 | is Value of variable |
e.g: floatingVariable = 5.67
| floatingVariable | is Name of variable |
|---|---|
| 5.67 | is Value of variable |
| 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 |