Variables can store data of different types, and different types can do different things.
Python has data types built-in by default.
There are 7 categories of data types built-in in Python. These 7 categories have subcategories as well. I will describe some of them in short which are important for beginners, but of course I will discuss them in details on separate episodes in coming videos.
Str: The string is a sequence of characters. Python supports Unicode characters. Generally, strings are represented by either single or double quotes.
• int – holds signed integers of non-limited length.
• float- Any real number with a floating point representation in which a fractional component is denoted by a decimal symbol or scientific notation.
• complex- holds complex numbers.
In Python we need not to declare datatype while declaring a variable like C or C++. We can simply just assign values in a variable.
List: The list is a versatile data type exclusive in Python. In a sense, it is the same as the array in C/C++. But the interesting thing about the list in Python is it can simultaneously hold different types of data. Formally list is an ordered sequence of some data written using square brackets() and commas(,).
Tuple: Tuple is another data type which is a sequence of data similar to list. But it is immutable. That means data in a tuple is write protected. Data in a tuple is written using parenthesis and commas.
Dict: Python Dictionary is an unordered sequence of data of key-value pair form. It is similar to the hash table type. Dictionaries are written within curly braces in the form key:value. It is very useful to retrieve data in an optimized way among a large amount of data.
Set Types: set, frozenset
Bool: Data with one of two built-in values True or False. Notice that 'T' and 'F' are capital. true and false are not valid booleans and Python will throw an error for them.
Binary Types: bytes, bytearray, memoryview