🐍 Python Basics: Variables, Data Types & Operators
Python आज के समय की सबसे popular programming language है, खासकर Data Science और AI के लिए। इस ब्लॉग में हम Python के core concepts को हिंदी में समझेंगे: Variables, Data Types, और Operators।
🔹 Variables (वेरिएबल्स)
Variables memory locations हैं जो data को store करने के लिए use किए जाते हैं। Python में variable declare करने के लिए किसी type को explicitly define करने की जरूरत नहीं होती। Example:
x = 10 name = "Ds" pi = 3.14
यहाँ x
, name
, और pi
variables हैं। Python automatically इनके type को detect कर लेता है।
🔹 Data Types (डेटा टाइप्स)
Python में common data types निम्नलिखित हैं:
- Integer (int): पूरी संख्या, जैसे 5, -10
- Float (float): Decimal संख्या, जैसे 3.14, -0.5
- String (str): Text data, जैसे "Hello World"
- Boolean (bool): True या False
- List: Multiple values का collection, जैसे [1, 2, 3]
- Tuple: Immutable collection, जैसे (1, 2, 3)
- Dictionary (dict): Key-value pairs, जैसे {"name":"Ds", "age":25}
- Set: Unique unordered values, जैसे {1, 2, 3}
🔹 Operators (ऑपरेटर्स)
Python में विभिन्न types के operators होते हैं जो variables और values पर operations perform करते हैं:
- Arithmetic Operators: +, -, *, /, %, **, //
- Comparison Operators: ==, !=, >, <, >=, <=
- Logical Operators: and, or, not
- Assignment Operators: =, +=, -=, *=, /=
- Membership Operators: in, not in
- Identity Operators: is, is not
💡 Examples (उदाहरण)
# Variables & Data Types x = 10 y = 3.5 name = "Ds" is_active = True # Arithmetic Operators sum = x + y diff = x - y prod = x * y div = x / y # Comparison print(x > y) # True # Logical print(is_active and (x > y)) # True
📊 Python for Data Science
Python का syntax सरल और readable है, जो इसे Data Science और Generative AI के लिए ideal बनाता है।
Libraries जैसे NumPy
, Pandas
, Matplotlib
, Seaborn
, और Scikit-learn
data processing और analysis को आसान बनाते हैं।
Python सीखना AI और ML career के लिए पहली और महत्वपूर्ण step है।
🏆 निष्कर्ष
Python Basics जैसे Variables, Data Types और Operators सीखना हर beginner के लिए essential है। यह foundation AI, Generative AI और Data Science के advanced topics को समझने में मदद करता है। लगातार practice और examples के साथ Python programming में proficiency हासिल की जा सकती है।