RPA | Python Data Types| Jupyter Notebook - Part-46
Data Types in Python - In this blog we will discuss about the various variable data types that are available in Python using Jupyter Notebook one of the IDE that python has made available to all of us and it is available when we install Anaconda Navigator.
So there are various data types that are available in python which are listed as below:
- Text Type
- Numeric Types
- Sequence Types
- Mapping Type
- Set Types
- Boolean Type
- Binary Type
Now we will discuss each of the data type in detail one by one along with the examples for each data type.
- Text Type - It is the data type which can contain the single digit character, sequence of characters etc. So now we will look at the example of text data types in Python using Jupyter Notebook as follows:
vartext='Hello Today is Tuesday'
Now just simply type in vartext you will get the data that we have stored in the variable. To check the type of vartext we will use the following syntax as shown below.
type(vartext)
and click on run the output or the type that you will get is str. Here is the snapshot for the code as shown below.
- Numeric Types - In this data type numbers and fraction values i.e. decimal point values are also being considered under this data type. In this category both integer and floating data types exists. So now let us see an example for both categories.
num1=12
num2=12.33
Now if we check the type of num1 and num2 variables then num1 should fall under the integer category and num2 should fall under the float category. So now we will see the code snippet for this data type.
- Sequence Type - This data type consists of various categories such as list, tuples and range variable data types. We will discuss each of the three variable data types in detail. So now let us first see the example of list variable data types in python.
Next we have the tuples in our category which is used to store or contain multiple items in a single variable. An example of tuples is as follows:
Last data type under this category is the range data type for which an example would be as follows:
- Mapping Type - In the mapping type we have the dictionary variable data type. A dictionary variable data type consists of collection of key-value pairs or key-value items. The example for dictionary variable data type is as follows:
- Boolean Data Type - In this data type we have one value from either of the available options i.e. True or False. In this data type the value can be either true or false. So now let us see an example of Boolean data type which is as follows:
- Binary Data Type - This data type consists of three subsets i.e. bytes, bytearray and memoryview. So now we will see an example for each of the three categories which is as follows:
So with that we have come to the end of our blog where we discussed about the various data types that Python has or Python supports. Also we discussed or saw the various examples for each of the variable data types that we discussed above.
If you have any queries regarding this article or blog then you can raise your queries in the comment section and I would be more than happy to answer all of your queries.
Lastly I would like to conclude by saying that please provide your valuable feedback after going through the blog as the feedback that you share really matters the most to me.
Comments
Post a Comment
If you have any doubts, please letme know.