First of all we need to know when defining a variable in Python, we do not need to specify the type of the variable. Python determines its own data type according to the value we assign.
For this, we still need to do some type of conversion process should not forget. What is the type of data in Python, data type conversion when necessary will prevent us from having trouble in future.
What's in the article ?
What Is Python Data Types ?
In total there are 5 data types in the Python programming language :
1 . Python Number Data Type
This data type is also divided into 4;
- Long Integer
Integer : The positive and negative numbers we see in mathematics are all called, and Python is a basic type of numeric data. For example; 5, -10, 423365 and the like.
Float : It is called all of the fractional negative and positive numbers that we see in mathematics. Like Integer, Python is a numeric base data type. For example; 5.25, -4.10, 456.40, and so on.
Long Integer : A data type representing long integers. Long Integer is used in such cases where Integer data types will be insufficient for very large figures; 5533514554585L, 7L
Complex : Complex numbers are commonly used in embedded systems. They are shown as follows; 5 + 12j, 4-3j etc.
2. Python String Data Type
Python is also a data type of text type, that is, strings. It is not possible to add, subtract, or modify this data type. Further issues will be explained in detail with their methods.
3. Python Tuple Data Type
These are the types of data that come together by different data types; that is, a Tuple can be an integer, a decimal number, text, and even a Tuple within another Tuple. You cannot add, remove, or modify elements of this data type. Further topics will be explained in detail.
4. Python List Data Type
Lists are formed by the combination of different data types, such as Tuple. The list consists of integer, decimal, string, tuple and lists. The difference from the tuple data type is that you can element this data type; You can add, remove and modify operations, the following topics will be explained in detail with the methods. The usage is as follows.
5. Python Dictionary Data Type
Dictionaries also have different data types, such as Tuple and List data types, but dictionaries are slightly different. Dictionaries are expressed in fancy brackets and consist of two parts; keys and value, the value part can contain all data types, but the keys part can only be of type string and int. Changeable data types in dictionaries and add, remove, etc. transactions can be made.