Python Data Types In Hindi | Python Programming In Hindi

Python Data Types In Hindi In Python Programming

Python Data Types in Hindi: Python ek aisi programming language hai jo seekhne aur use karne mein bahut aasan hai. Iske simplicity aur flexibility ke kaaran, Python beginner aur experienced programmers ke beech kaafi popular hai. Python Programming In Hindi mein hum detail mein Python ke different data types ke baare mein jaanenge, jo kisi bhi program ka basic building block hote hain. So lets learn Python Data Types In Hindi:

Python Data Types In Hindi | Python Programming In Hindi
Python Data Types In Hindi

Python ke Data Types (Python Data Types in Hindi)

Programming mein data types ek fundamental concept hai. Data types ke through hi hum kisi variable ke liye logic implement karte hain. Data types ka simply matlab hai kisi variable ka type, jisse humein pata chal sake ki variable kis type ki value hold kar raha hai ya future mein hold karega. Python bahut flexible language hai, jahan programmer ko variable ka type define karne ki zarurat nahi hoti. Runtime mein hi variable ka type decide ho jaata hai.

यह भी पढ़ें: 250+ Free Python Projects with Source Code: From Beginner to Advanced

Built-in Data Types in Python

Python mein kuch built-in data types hote hain jo alag-alag tarah ki values ko represent karte hain:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Binary Types: bytes, bytearray, memoryview
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool

Data Type Check karne ke liye type() Function

Python mein kisi bhi variable ka data type jaanne ke liye type() function ka use hota hai. Example:

age = 90
name = 'Rahul'
print(type(age))  # Output: <class 'int'>
print(type(name))  # Output: <class 'str'>

Python Numeric Data Types

Numeric data types mein woh sabhi numeric values aati hain jinpar hum arithmetic operations perform kar sakte hain. Python mein numeric data types teen tarah ke hote hain: int, float, aur complex.

  • int: Integer values bina decimal ke hote hain, jaise - 1, 100, -50.
  • float: Floating-point values jo decimal ke saath hote hain, jaise - 3.14, 2.718.
  • complex: Complex numbers jo real aur imaginary parts ke saath hote hain, jaise - 4+5j.

Example:

int_var = 100
float_var = 35.7
complex_var = 4 + 5j
print(type(int_var))  # Output: <class 'int'>
print(type(float_var))  # Output: <class 'float'>
print(type(complex_var))  # Output: <class 'complex'>

Python String Data Type

String ek sequence hota hai characters ka jo single ya double quotes mein likhe jaate hain. Example:

str1 = 'Hello, Python!'
str2 = "Python Programming In Hindi"
str3 = '''This is a 
multiline string'''
print(type(str1))  # Output: <class 'str'>
print(type(str2))  # Output: <class 'str'>
print(type(str3))  # Output: <class 'str'>

Strings mein indexing aur slicing ka use karke hum specific characters ko access kar sakte hain.

Python Boolean Data Type

Boolean data type sirf do values hold karta hai: True aur False. Boolean data types ko logical operations aur comparisons ke liye use kiya jaata hai. Example:

bool1 = True
bool2 = False
print(type(bool1))  # Output: <class 'bool'>
print(type(bool2))  # Output: <class 'bool'>

Python Sequence Data Types

Sequence types mein woh data types aate hain jo multiple values ko ek sequence mein store karte hain, jaise - list, tuple, aur range.

List

List ek ordered collection hota hai jo different types ki values ko store kar sakta hai. List ko square brackets [] ke andar likha jaata hai. Example:

my_list = [1, 2.5, "Python", True]
print(type(my_list))  # Output: <class 'list'>
print(my_list)  # Output: [1, 2.5, 'Python', True]

List ko update, append, aur delete bhi kiya ja sakta hai.

Tuple

Tuple bhi list ki tarah hota hai, lekin immutable hota hai, yani iski values ko change nahi kiya ja sakta. Tuple ko parentheses () ke andar likha jaata hai. Example:

my_tuple = (1, 2.5, "Python", True)
print(type(my_tuple))  # Output: <class 'tuple'>
print(my_tuple)  # Output: (1, 2.5, 'Python', True)

Range

Range ek sequence create karta hai numbers ka jo mostly loops mein use hota hai. Example:

my_range = range(1, 10)
print(type(my_range))  # Output: <class 'range'>
print(list(my_range))  # Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]

Python Mapping Data Type

Mapping type mein dictionary aata hai jo key-value pairs ko store karta hai. Dictionary ko curly braces {} ke andar likha jaata hai aur key-value pairs ko colon : se separate kiya jaata hai. Example:

my_dict = {"name": "Rahul", "age": 25, "city": "Delhi"}
print(type(my_dict))  # Output: <class 'dict'>
print(my_dict)  # Output: {'name': 'Rahul', 'age': 25, 'city': 'Delhi'}

Python Set Data Types

Set ek unordered collection hota hai unique values ka. Set ko curly braces {} ke andar likha jaata hai. Example:

my_set = {1, 2, 3, 4, 5}
print(type(my_set))  # Output: <class 'set'>
print(my_set)  # Output: {1, 2, 3, 4, 5}

Set mein duplicate values allow nahi hoti hain.

Python Frozenset Data Type

Frozenset bhi set ki tarah hota hai, lekin immutable hota hai. Iski values ko change nahi kiya ja sakta. Example:

my_frozenset = frozenset([1, 2, 3, 4, 5])
print(type(my_frozenset))  # Output: <class 'frozenset'>
print(my_frozenset)  # Output: frozenset({1, 2, 3, 4, 5})

Python Binary Data Types

Python mein kuch binary data types bhi hote hain jaise bytes, bytearray, aur memoryview.

Bytes

Bytes ek immutable sequence hota hai bytes ka. Example:

my_bytes = b'Python'
print(type(my_bytes))  # Output: <class 'bytes'>
print(my_bytes)  # Output: b'Python'

Bytearray

Bytearray ek mutable sequence hota hai bytes ka. Example:

my_bytearray = bytearray(5)
print(type(my_bytearray))  # Output: <class 'bytearray'>
print(my_bytearray)  # Output: bytearray(b'\x00\x00\x00\x00\x00')

Memoryview

Memoryview ek way provide karta hai buffer-protocol ke through binary data ko access karne ka bina data copy kiye. Example:

my_bytes = b'Python'
my_memoryview = memoryview(my_bytes)
print(type(my_memoryview))  # Output: <class 'memoryview'>
print(my_memoryview)  # Output: <memory at 0x7f8b83e4dc40>

Python Keywords In Hindi

Python mein kuch reserved words hote hain jo specific meanings aur functions perform karte hain. Inhe keywords kehte hain. Example: False, True, None, and, or, not, if, else, elif, for, while, break, continue, class, def, return, etc.

In keywords ka use variable names ke roop mein nahi kiya ja sakta. Ye language ke predefined functions aur control flow ko define karte hain.

Conclusion

Is article mein humne Python Programming In Hindi ke through different data types ko samjha. Python ek flexible aur powerful language hai jo alag-alag tarah ki data types ko support karti hai. Is flexibility ke kaaran, Python beginners ke liye ideal language hai. Aap Python ke data types ko samajh kar easily apne programs mein implement kar sakte hain aur powerful applications develop kar sakte hain.

Python seekhne aur use karne mein aasan hone ke kaaran duniya bhar mein popular ho rahi hai. Python Programming In Hindi articles aur tutorials ke through aap Python ko aur achhi tarah se seekh sakte hain aur apne programming skills ko enhance kar sakte hain.

Yadi aapko yeh article Python Data Types in Hindi pasand aaya ho, to ise apne doston ke saath share karna na bhoolein.

यह भी पढ़ें: Python Programming In Hindi | Python Tutorials In Hindi

और नया पुराने

संपर्क फ़ॉर्म