Home >> Python Tutorial >> Python Data Type
Edit Template
Edit Template

Python Data Type

What is Python Data Type in Hindi

Python Data Type : variable  में हम जब भी कोई data store करते हैं तो उसका एक type होता है, python में कई तरह के data type होते हैं जैसे : numeric, sequence, set, etc.  लिए इनके बारे में अच्छे से समझते हैं।

आसान भाषा मे कहे तो data type हमे बताता है की variable मे हम कैसी information को store कर रहे है क्या वो number है, text है या कुछ और।

Data Types in Python

python मे अलग अलग types के information को store करने के लिए अलग अलग types के data type होते है। जैसे : – 

Numeric Data Type in Hindi

Numeric data type numbers को represent करता है जैसे: 1, -1, 1.5 जितने भी numbers होते हैं इन्हें numeric data type कहा जाता है। 

python में numeric data type तीन तरह के होते हैं. Integers, floating-point numbers, complex numbers. 

  • integers वह सभी numbers होते हैं जो बिना decimal point के होते हैं, यह positive, negative या zero हो सकते हैं जैसे : 1, -4, 0.
  • Floating point numbers वह numbers होते हैं जो decimal point के साथ होते हैं, जैसे : 3.15, – 1.2, 0.0 etc.
  • Complex numbers वह numbers होते हैं जो real और imaginary port को combine करते हैं,  जैसे : 1+3j, 2-5j, etc.

Sequence Data Type in Hindi

Sequence data type, text  represent करता है जैसे: string, list, tuple इनके बारे में अब आगे अच्छे से समझेंगे। 

Single and double quote के अंदर हम कुछ लिखते हैं तो यह string कहलाता है। 

Triple quote के अंदर हम कुछ लिखते हैं तो भी यह string कहलाता है इसका use हम multi line string के लिए करते हैं।

Mapping Data Type in Hindi

Mapping type जैसे की dict यह key value pairs का unordered collection होता है, इसके uses को आगे समझेंगे। 

Set Data Type in Hindi

Set type, set unique items का unordered collection होता है आपने math में set तो पढ़ा ही होगा कुछ इसी type का यह भी होता है इसके बारे में अब आगे समझेंगे। 

Boolean Data Type in Hindi

Boolean type, true ओर false को represent करता है।

None Data Type in Hindi

None type हम जब भी कोई variable बनाते हैं और अगर उसमें कोई value ना दे तो उसमें एक rough value आ जाती है, but हम चाहते इसमें कोई value ना हो तो इसमें none को assign कर देते हैं। 

🐍
data types.py
Copy to clipboard
# Numeric Data Types
integer_value = 10   # int
float_value = 20.5   # float
complex_value = 3 + 4j  # complex

# Text Data Type
string_value = "Hello, Python!"  # str

# Sequence Data Types
list_value = [1, 2, 3, 4, 5]  # list (mutable)
tuple_value = (10, 20, 30)  # tuple (immutable)

# Set Data Types
set_value = {1, 2, 3, 4, 5}  # set (unordered, unique values)
frozenset_value = frozenset({10, 20, 30})  # frozenset (immutable set)

# Mapping Data Type
dict_value = {"name": "Alice", "age": 25}  # dictionary (key-value pairs)

# Boolean Data Type
bool_value = True  # bool (True or False)

# Displaying types
print(integer_value)
print(float_value)
print(complex_value)
print(string_value)
print(list_value)
print(tuple_value)
print(set_value)
print(frozenset_value)
print(dict_value)
print(bool_value)

What is Casting Function

किसी data के data type को किसी और data type में convert करने के लिए इस method का use करते हैं

Int :  जब हम किसी value को integer में convert करते हैं तो ‘int’ का use करते हैं। 

🐍
int.py
Copy to clipboard
# Convert float and string to integer
float_num = 10.9
string_num = "25"

print(int(float_num))  # Output: 10 (Decimal part is removed)
print(int(string_num))  # Output: 25 (String is converted to int)

Float :  जब हम किसी value को floating point number में convert करते हैं तो ‘float’ का use करते हैं

🐍
float.py
Copy to clipboard
# Convert int and string to float
int_num = 10
string_float = "15.75"

print(float(int_num))  # Output: 10.0
print(float(string_float))  # Output: 15.75

Complex : जब हम किसी value को complex number में convert करते हैं तो ‘complex’ का use करते हैं.

🐍
complex.py
Copy to clipboard
# Convert int and float to complex
int_num = 5
float_num = 2.3

print(complex(int_num))  # Output: (5+0j)
print(complex(float_num))  # Output: (2.3+0j)

# Convert two numbers into a complex number (real + imaginary)
print(complex(3, 4))  # Output: (3+4j)

String : जब हम किसी value को string में convert करते हैं तो ‘str’ का use करते हैं

🐍
string.py
Copy to clipboard
# Convert int, float, and complex to string
int_value = 100
float_value = 25.6
complex_value = 3 + 5j

print(str(int_value))  # Output: "100"
print(str(float_value))  # Output: "25.6"
print(str(complex_value))  # Output: "(3+5j)"

उम्मीद करते है कि आपको python data type अच्छे समझ मे आ गया होगा । अपने learning को continue रखने के लिए next button पर click करे,

Add a comment...

  • All Posts
  • Artificial Intelligence
  • Computer Fundamentals
  • Computer Networks
  • Data Analytics
  • Data Science
  • DBMS
  • Deep Learning
  • Digital Fundamentals
  • DSA with Python
  • Excel
  • Exercise
  • Git & Github
  • Machine Learning
  • Matplotlib
  • Natural Language Processing
  • NumPy
  • Operating System
  • Pandas-s
  • Power BI
  • Python Tutorial
  • Scikit-learn
  • Seaborn
  • SQL & MySQL
File Pointer

Table of Contents All Chapters 1. File Pointer 2. File Pointer Methods      2.1. tell() Method      2.2....

File Handling

Table of Contents All Chapters 1. File Handling 2. Types of File 3. open() and close() Methods 4. File Modes...

Python Modules

Table of Contents All Chapters 1. Modules in Python 2. Pre-defined Modules      2.1. math      2.2. random...

Python Iterators

Table of Contents All Chapters 1. Iterators      1.1. Iterable      1.2. Iterator      1.3. Iterator Protocol...

Python Polymorphism

Table of Contents All Chapters 1. Polymorphism 2. Key Concepts of Polymorphism 3. Types of Polymorphism      3.1. Polymorphism...

Python Inheritance

Table of Contents All Chapters 1. Inheritance 2. Concepts of Inheritance 3. Types of Inheritance      3.1. Single Inheritance...

Python Function

Table of Contents All Chapters 1. Python Function 2. Define Function 3. Function Arguments 4. Function Parameters 5. Local and...

Python Dictionary

Table of Contents All Chapters 1. Python Dictionary 2. Access Dictionary items 3. Change Dictionary items 4. Add items in...

Edit Template
Scroll to Top