Python Hindi Logo
Python in Hindi | Programming Education
Python programming tutorial in Hindi banner Python code learning illustration Hindi Python student coding illustration Python data code pattern background
🇮🇳 Learn Python in Hindi

Python Tutorial in HindiiLearn Python Programming for Free

Learn Python from Beginner to Advanced in simple Hindi. Explore tutorials, projects, interview questions, quizzes, notes, and career guidance—all in one place.

50+
Tutorials
100%
Free
Hindi
Medium
print("Namaste Python!")
# Variable banana
naam = "Ankit"
umar = 25
 
for i in range(3):
  print("Sikho!")
 
# Output:
Sikho! Sikho! Sikho!

Python Data Types in Hindi | Beginner Complete Guide

Python Data Types in Hindi - int, float, string, list, tuple, dictionary, set aur boolean ka overview - PythonHindii.in
Python Data Types in Hindi (Python 3.13) – Complete Beginner Guide

If you've just begun learning Python programming, understanding Python data types is one of the most important steps. Every program uses some data type to store, process, and manipulate data. With a strong understanding of data types in Python , you'll find it much easier to understand variables, conditions, loops, and functions.

Python's biggest strength is that it's a dynamically typed programming language. This means we don't have to manually define a variable's data type when creating it. Python automatically identifies the type by looking at the value, and can convert it if necessary.

If you haven't yet read about variables, be sure to read the Python Variables in Hindi tutorial first— Python variables and data types are directly connected concepts. Similarly, if you need to understand Python's reserved words, the Python Keywords in Hindi article will also be very useful.

If you're completely new to Python, be sure to check out our Python Tutorial in Hindi, which covers all topics from beginner to advanced step-by-step. Next in this Python 3.13 tutorial series, we 'll cover Python Data Types Explained , complete with practical Hindi examples.

What is Python Data Type?

In simple language, Data Type tells what type of data is stored inside a variable – number, text, list, or something else.

For example, if a variable stores a number, its data type will be different. If it stores text, its data type will be different. Python automatically decides the type of value, so we don't need to write any extra syntax.

Example:

age = 20
name = "Ankit"
price = 99.99
is_student = True

Here Python automatically understands that:

  • 20is an integer.
  • "Ankit"is a string.
  • 99.99There is a float.
  • Trueis a Boolean.

For this reason, Python is considered a very easy language for beginners. You can also find detailed documentation on the official Python Standard Types docs .

Why are Python data types important?

There are many benefits of understanding data types:

  • Variables can be used in the right way.
  • Memory management gets better.
  • Errors are reduced.
  • The code becomes readable and maintainable.
  • It becomes easy to work with functions and libraries.

If you want to pursue data science, machine learning, automation, or web development in the future, a strong understanding of data types is crucial. This entire Python Basics tutorial builds on this foundation.

Python ke Built-in Data Types

There are many built-in data types available in Python 3.13, which are divided into categories.

Category Data Types
Numericint, float, complex
Textstr
Sequencelist, tuple, range
Mappingdict
Setset, frozenset
Booleanbool
Binarybytes, bytearray, memoryview
SpecialNoneType

In this article, we will first understand Numeric Data Types in detail, after that we will also cover Text, Sequence, Mapping, Set, Boolean, Binary and Special data types step by step.

Numeric Data Types in Python

Numeric Data Types numbers ko represent karte hain. Python me mainly teen numeric data types hote hain:

  • Integer (int)
  • Float
  • Complex

These three are used in different situations.

Integer (int)

Integers are those numbers which do not have a decimal point.

Example:

age = 22
marks = 95
temperature = -5
population = 1400000000

To check the output:

age = 22
print(type(age))

Output

<class 'int'>

Integer can be positive, negative and zero.

10
0
-100
5000
999999999999

The size of integers in Python is practically unlimited. Therefore, even very large numbers can be easily stored, as long as system memory allows.

Float Data Type

Floats are those numbers which have a decimal point.

Example:

price = 199.99
height = 5.8
pi = 3.14159

Let's check the type.

price = 199.99
print(type(price))

Output

<class 'float'>

Float ka use generally in situations me hota hai:

  • Percentage
  • Height / Weight
  • Temperature
  • Scientific Calculations
  • Currency Values
temperature = 36.6
discount = 15.5
salary = 45250.75

Integer aur Float me Difference

IntegerFloat
it is not decimalIt is decimal
Example: 10Example: 10.5
For exact countingFor decimal calculations
a = 10
b = 10.5

print(type(a))
print(type(b))

Output

<class 'int'>
<class 'float'>

   Complex Data Type

Complex numbers are rarely used in normal programming, but are very important in scientific computing, engineering, and mathematics. In Python, j is used for imaginary numbers .

x = 5 + 3j
print(x)

Output

(5+3j)
print(type(x))
<class 'complex'>

To separate the real and imaginary parts:

print(x.real)
print(x.imag)

Output

5.0
3.0

If you're a beginner, just understanding complex numbers at a basic level is enough. You'll find practical applications in data science and scientific programming.

   How to check data type using type() function?

type()In Python , function is used to know the data type of any variable .

name = "Python Hindi"
age = 20
price = 199.99
student = True

print(type(name))
print(type(age))
print(type(price))
print(type(student))

Output

<class 'str'>
<class 'int'>
<class 'float'>
<class 'bool'>

This function is very useful for both debugging and learning.

So far, you've understood Python's numeric data types—Integer, Float, and Complex—to use. But in real-world programming, you work with more than just numbers, but also text, collections, and logical values. So, let's explore the other data types in detail with these Python data type examples .

   String (str) Data Type

Strings are used to store text or characters. In Python, strings can be written within single quotes ( ' '), double quotes ( " "), or triple quotes ( ''' '''/ ).""" """

name = "Ankit"
city = 'Lucknow'

print(name)
print(city)

Output

Ankit
Lucknow

Letters, numbers and special characters can also be stored in the string.

message = "Welcome to Python Hindi"
print(type(message))

Output

<class 'str'>

  String ki Common Operations

name = "Python"

print(len(name))
print(name.upper())
print(name.lower())
print(name[0])
print(name[-1])

Output

6
PYTHON
python
P
n

Strings in Python are immutable, meaning that once created, their characters cannot be directly changed. This can be read in detail in the Python String Documentation .

   List Data Type

Lists are Python's most popular collection data type. Multiple values ​​can be stored in a single variable. Lists []are written within square brackets.

fruits = ["Apple", "Mango", "Banana"]
print(fruits)

Output

['Apple', 'Mango', 'Banana']

The list is mutable, meaning the data can be changed.

fruits.append("Orange")
print(fruits)

Output

['Apple', 'Mango', 'Banana', 'Orange']

List me duplicate values allow hoti hain.

numbers = [10, 20, 10, 30]

The list supports indexing.

print(fruits[0])
print(fruits[2])

   Tuple Data Type

A tuple also stores multiple values ​​like a list, but a tuple is immutable. A tuple ()is written within parentheses.

colors = ("Red", "Green", "Blue")
print(colors)

Output

('Red', 'Green', 'Blue')

The data in a tuple cannot be changed once it is created. This is why tuples are used to store fixed data.

days = ("Mon", "Tue", "Wed")

List aur Tuple me Difference

ListTuple
MutableImmutable
[] Brackets() Parentheses
A little slowa little faster
Change may happenChange cannot happen

If the data is subject to future modification, use a List, and if the data is fixed (such as days of the week or coordinates), a Tuple is a better choice.

    Dictionary (dict)

A dictionary is a key-value pair data type in Python. Each value is stored with a unique key.

student = {
    "name": "Ankit",
    "age": 20,
    "course": "Python"
}

print(student)

Output

{'name': 'Ankit', 'age': 20, 'course': 'Python'}

Keys are used to access specific values.

print(student["name"])

Output

Ankit

Dictionary is mutable.

student["city"] = "Lucknow"

Dictionary is used a lot in real-life projects, such as API responses, JSON data and database records.

  Set Data Type

A set is an unordered collection. Its most important feature is that duplicate values ​​are automatically removed.

numbers = {10, 20, 30, 20, 10}
print(numbers)

Output

{10, 20, 30}

Set is used to store unique values.

emails = {
    "abc@gmail.com",
    "xyz@gmail.com",
    "abc@gmail.com"
}

Here the duplicate email will be stored only once.

frozenset

frozensetIt is similar to a set, but it is immutable – meaning that once created, no items can be added or removed from it.

fs = frozenset([1, 2, 3])
print(fs)
print(type(fs))

Output

frozenset({1, 2, 3})
<class 'frozenset'>

    Boolean Data Type (bool)

         Boolean represents only two values:

  • True
  • False
is_logged_in = True
is_admin = False
print(type(is_logged_in))

Output

<class 'bool'>

Boolean is used in conditions.

age = 18
print(age >= 18)

Output

True

If you're going to learn If Else statements, understanding Boolean functions is crucial. Python If Else in Hindi (coming soon) .

Binary Data Types: bytes, bytearray aur memoryview

Python's binary data types come in handy when we need to work with raw binary data (such as files, images, or network data) instead of text.

bytes

bytesis an immutable sequence that stores only integer values ​​from 0 to 255.

data = bytes([65, 66, 67])
print(data)
print(type(data))

Output

b'ABC'
<class 'bytes'>

byte array

bytearray, bytesbut it is mutable, meaning the values ​​can be changed.

b = bytearray([65, 66, 67])
b[0] = 90
print(b)

Output

bytearray(b'ZBC')

memoryview

memoryviewAn object that allows you to directly access a memory buffer without copying the data. This is memory-efficient when working with large data (such as images or files).

data = bytearray([1, 2, 3, 4])
mv = memoryview(data)
print(mv[0])
print(list(mv))

Output

1
[1, 2, 3, 4]

You can find a detailed reference on binary data types in the official Python Binary Sequence Types docs .

  NoneType

  Sometimes a variable doesn't have a value assigned to it. In such cases None, Python uses

   data = None
   print(data)

   Output

   None
   print(type(data))

   Output

   <class 'NoneType'>

   Noneis used a lot in functions, APIs, and database programming—such as when a function     doesn't return anything, or when a variable's value hasn't been set yet.

    isinstance() Function – type() se Better Kyun?

type()Python also has another useful function — is isinstance(). It checks whether a variable is of a specific data type, and it also handles inheritance (subclasses), so it is highly recommended in certain conditions.

age = 20

print(isinstance(age, int))
print(isinstance(age, str))
print(isinstance(age, (int, float)))

Output

True
False
True

type() vs isinstance()

type()isinstance()
Exact type return karta haireturns True/False
Does not consider inheritanceAlso considers inheritance
Useful for debuggingRecommended for conditions

Type Conversion ka Chhota Introduction

Sometimes we need to convert one data type to another. This is called type casting .

a = "25"
b = int(a)

print(type(a))
print(type(b))

Output

<class 'str'>
<class 'int'>

We will discuss Type Casting in a separate detailed article Python Type Casting in Hindi , which will be published soon.

Data Types ki Mutability Table (Quick Reference)

Data TypeMutable?
int, float, complexImmutable
strImmutable
listMutable
tupleImmutable
dictMutable
setMutable
frozensetImmutable
boolImmutable
bytesImmutable
byte arrayMutable
NoneTypeImmutable (single value)

    Common Mistakes for Beginners Karte Hain

  • Mistaking a string for a number: age = "20" Writing this will result in a string, not an integer. This can lead to errors in arithmetic operations.
  • Confusing List and Tuple: Beginners often try to change the values ​​in a Tuple, which gives an error because Tuple is immutable.
  • Ignoring float precision: 0.1 + 0.2 Sometimes operations 0.30000000000000004result in a different result due to floating-point precision.
  • Relying on Set Order: Sets are unordered, so the order of items is not guaranteed at print time.
  • Accessing the wrong key in the dictionary: This happens if the key does not exist KeyError; hence .get()it is safer to use this method.
  • Considering None as an empty string or zero: None , ""and 0all three are different, it is a mistake to consider them equal.

     Interview Questions on Python Data Types

  1. How many categories are Python's built-in data types divided into?
  2. What is the fundamental difference between List and Tuple?
  3. Why are duplicate values ​​not stored in a set?
  4. type()And isinstance()what is the difference between me?
  5. What is the meaning of mutable and immutable data types in Python?
  6. What is the key data type of the dictionary?
  7. bytesAnd bytearraywhat is the difference between me?
  8. What could be the real-world use case of complex data type?
  9. NoneWhen is '?' used in Python ?
  10. How is a Frozen set different from a normal set?

    Practice Exercises

  1. Create a variable that stores your name, age, and city, and type()print all three with the data type.
  2. Make a list containing 5 fruits, then add one new fruit and remove one fruit from it.
  3. Create a tuple containing 3 cities and print them.
  4. Create a dictionary that stores the details (name, salary, department) of an employee.
  5. Create a set in which you deliberately enter duplicate numbers and observe the result.
  6. isinstance()Do this and check whether there intis any variable or not float.
  7. bytesConvert a string into and print it.

     Key Takeaways

  • Python dynamically typed language hai, isliye variable ka data type automatically decide hota hai.
  • Numeric types include int, float and complex.
  • String is immutable, whereas List and Dictionary are mutable.
  • Tuple and frozenset are immutable collections, which are used for fixed data.
  • Set duplicate values automatically remove kar deta hai.
  • Binary data types (bytes, bytearray, memoryview) are used to handle raw data.
  • type()Tells the exact type, while isinstance()checking with inheritance.
  • Noneis used to represent "no value".

    Real-Life Example

       Suppose we want to store information about a student.

       name = "Ankit"
       age = 20
            height = 5.8
      is_student = True

      skills = ["Python", "HTML", "CSS"]

       student = {
           "Name": name,
           "Age": age,
          "Height": height,
          "Student": is_student,
          "Skills": skills
             }

           print(student)

       In this single program, you can see several Python data types being used                  simultaneously.    

        Similarly, in real-world Python applications, complex programs are created by         combining multiple data types.

       FAQ

                  1. How many built-in data types are there in Python?
             Python has a total of 8 categories: numeric, text, sequence, mapping, set, boolean,                  binary, and NoneType, which contain more than 12 individual data types.

            2. Why is Python a dynamically typed language?
            Because you don't need to manually specify the data type when declaring a variable    Python automatically determines the type based on the value.

    3. Which is better, a list or a tuple?
   This depends on the use case. If the data is changing, a list is better; if the data is fixed, a    tuple is better.

              4. What is the biggest use case for Sets?
                Automatically removing duplicate values ​​and maintaining unique data is the most                    common use case for Sets.

5. Can dictionary keys be duplicated?
No, dictionary keys must always be unique, but values ​​can be duplicated.

6. Are None and 0 the same thing in Python?
No Nonemeans "no value," while 0 0is a valid integer value. The two are different.

7. What is the difference between bytes and bytearray?
bytes Byte is immutable while bytearraybyte is mutable, meaning its values ​​can be changed.

8. Why is using isinstance() considered better than type()?
Because isinstance()it also handles inheritance (subclasses), making it more reliable to write conditions.

      9. Are complex data types used in real projects?
    Yes, they are mainly used in scientific computing, signal processing, and engineering     calculations; they are less commonly used in general web or app development.

10. What should you learn next after learning about data types?
After data types, the correct sequence would be to learn operators, type casting, and if-else conditions, which you will find in the next articles of this series.

   Conclusion

   You now understand almost all of Python's important built-in data types—Integer, Float,      Complex, String, List, Tuple, Dictionary, Set, frozenset, Boolean, bytes, bytearray,    memoryview, and NoneType. You also learned type()how isinstance()to check the data type    of any variable, what common mistakes are, and what you might be asked in an interview.

You can now manage variables and data correctly in Python. In the next tutorials, we'll cover Type Conversion (Type Casting), a deep-dive into practical interview questions, more examples of common mistakes, best practices, and additional practice exercises.

   Related Articles

     Python Series