28/05/2023
python data types

Python always works with variables, so it’s very important because variables hold values, and every value has a data type. Python all including points of an object that is data type Python write code automatically, here no need to define the data type. 

Data Type includes what kinds of operations can be done using this, representing the python classes. 

In this article, we learn all kinds of data types that work on variables of the python programming language. So let’s get started to learn and practice-

Variables always store data in their different types, and different data do different works at a time. Here I explain all kinds of standard data types, so you learn this, you will acquire knowledge of data type.

All kinds of python data types

A variable stores different kinds of values that all provide different data types. For example, if you write a name, it may be anyone or anything that contains string data at the same time, you type someone’s phone number that contains the number value. 

X = “Anirban Hossain”

#display x :

print(x) 

#display the datatype of x :

print(type(x))

And when you add to a phone number that man, here you need to the code –

y=”01575124527”

#display y :

print(y)

# display the datatype of y:

print(type (y))

The output of these codes on python –

So it’s clear to define data types with every value different. 

Now we know how many kinds of data are in Python. There are many kinds of data types here that are listed below-

  • Sequence type data
  • Dictionary type data
  • Set data
  • Boolean data
  • Numeric data 

Including point of these have to divide many kinds that show a chart box, follow this to clear concept of data type –

Now I share all of these data type details for your total concept of the python programming language that is very helpful as a beginner step and makes you an expert of this language. 

Sequence type data

This is a multiple data storage that is called a database. It defines any character like name, paragraph, heading, place, and more. There are 3 kinds of sequence type data that like –

  1. String- It identifies single quote or double quotation marks anywhere you find a quote called string data. Example of String data – any single world, name, place, and more. Like your name -” Anirban Hossain” or ‘Anirban Hossain .’Now you want to include this on python, that is –

str = “string used multiple quotes”

print(str) 

s=“” I am Anirban Hossain, an SEO expert, and owner of the WigMarketing Company“”)

print(s)

 The output of the code –

2. List- it is similar to programming language C array and the list contains commas to provide different datatypes started and end with square brackets. 

Also you want to use slice to access the data lists as operators, here operators(+) and  (*) works totally the same in this list. Example of this python list-

lists(“Web Design”, “Web Development”, “Search Engine Optimization”)

Output of these

3. Tuple – It contains the collection of different data types that start in a comma and end in parentheses. The extra power of the tuple can be read-only by a data structure that we can’t modify of this size value. tuple creates and reads data but cannot modify it.  

Basically used tuple to protect data and usually faster the list that can not do dynamically. 

Example of the Tuple-

Tup = (“Hi, Anirban”,2)

#checking type of tup

print(type(tup))

The output of tuple-

In this article, I try to explain all kinds of data types and fully understand the sequence data type. Hopefully, this content is helpful as a beginner. Learn python and continue to follow this.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Open chat
1
Hey, how can I help you?