Python Notes in Hindi (PDF) – Beginner to Advanced Complete Notes
Contents
1. Python क्या है?
Python एक high-level, general-purpose programming language है। इसका syntax सरल और पढ़ने में आसान होता है। Python का उपयोग web development, automation, data analysis, artificial intelligence, machine learning, scripting और software development में किया जाता है।
पहला Python Program
print("Hello, World!")
print() function स्क्रीन पर output दिखाने के लिए इस्तेमाल होता है।
2. Python की विशेषताएँ
- Easy to learn और readable syntax
- Interpreted language
- Cross-platform support (Windows, Linux, macOS)
- Large standard library और बड़ी community
- Automation और scripting में उपयोगी
- Web, Data Science, और AI libraries उपलब्ध
- Procedural, object-oriented, और functional programming का support
3. Basic Syntax, Comments, and Indentation
Python में code blocks को indentation से पहचाना जाता है। एक block के अंदर लिखी statements आमतौर पर समान indentation पर होती हैं।
# This is a comment
name = "Aman"
if name:
print("Welcome", name)
Comments के लिए # इस्तेमाल करते हैं। Python में indentation बहुत महत्वपूर्ण है।
4. Variables और Data Types
Variable किसी value को नाम देकर store करने का तरीका है। Python में variable बनाने के लिए अलग से type declare नहीं करना पड़ता।
age = 20 # int
price = 99.50 # float
name = "Aman" # str
is_student = True # bool
| Data Type | Example | Use |
|---|---|---|
| int | 10 | Integer numbers |
| float | 10.5 | Decimal numbers |
| str | "Python" | Text |
| bool | True / False | Logical values |
| NoneType | None | No value / empty state |
x = 25
print(type(x)) # <class 'int'>
5. Python Operators
| Category | Operators |
|---|---|
| Arithmetic | + - * / // % ** |
| Comparison | == != > < >= <= |
| Assignment | = += -= *= /= |
| Logical | and/or, not |
| Membership | in, not in |
| Identity | is, is not |
a = 10
b = 3
print(a + b) # 13
print(a // b) # 3 (floor division)
print(a % b) # 1 (remainder)
print(a ** b) # 1000 (power)
6. Input और Type Conversion
input() user से text input लेता है। जरूरत के अनुसार उसे int या float में बदलें।
age = int(input("Enter your age: "))
print("Next year you will be", age + 1)
Common conversions:
7. If, Elif, and Else
Conditions के आधार पर अलग code चलाने के लिए if, elif और else का उपयोग होता है।
marks = 75
if marks >= 90:
print("Grade A")
elif marks >= 60:
print("Grade B")
else:
print("Needs improvement")
8. Loops
Loops किसी काम को बार-बार करने के लिए इस्तेमाल होते हैं।
For Loop
for number in range(1, 6):
print(number)
While Loop
count = 1
while count <= 5:
print(count)
count += 1
break loop को रोकता है, continue वर्तमान iteration छोड़कर अगले iteration पर जाता है।
9. Strings
String text data होता है, जिसे quotes में लिखते हैं।
text = "Python Hindii"
print(text.upper())
print(text.lower())
print(text.replace("Hindii", "Bytes"))
print(text[0])
print(len(text))
Strings immutable होती हैं, यानी existing string को सीधे बदलने के बजाय नई string value बनती है।
10. List, Tuple, Set, और Dictionary
List
List ordered, mutable collection है।
fruits = ["apple", "mango", "banana"]
fruits.append("orange")
fruits.remove("mango")
print(fruits[0])
Tuple
Tuple ordered collection है, जिसे बनने के बाद बदला नहीं जा सकता (immutable)।
coordinates = (10, 20)
print(coordinates[0])
Set
Set unique elements रखता है और duplicate values को एक ही बार रखता है।
numbers = {1, 2, 2, 3, 4}
print(numbers) # duplicates are removed
Dictionary
Dictionary key-value pairs में data store करती है।
student = {"name": "Aman", "age": 20}
print(student["name"])
student["city"] = "Lucknow"
| Collection | Ordered | Mutable | Duplicates |
|---|---|---|---|
| List | Yes | Yes | Allowed |
| Tuple | Yes | No | Allowed |
| Set | No fixed order | Yes | Not allowed |
| Dictionary | Insertion order preserved | Yes | Keys unique |
11. Functions
Function reusable code block होता है। इसे def keyword से बनाते हैं।
def greet(name):
return "Hello, " + name
message = greet("Aman")
print(message)
Function arguments, return values, default parameters, और scope आगे सीखने के महत्वपूर्ण topics हैं।
12. Errors and Exception Handling
Unexpected errors को संभालने के लिए try और except इस्तेमाल किए जाते हैं।
try:
number = int(input("Enter a number: "))
print(100 / number)
except ValueError:
print("Please enter a valid integer")
except ZeroDivisionError:
print("Number cannot be zero")
13. File Handling
Python में files को open, read, write, और append किया जा सकता है। with statement file को सही तरीके से बंद करने में मदद करता है।
with open("notes.txt", "w", encoding="utf-8") as file:
file.write("Learning Python")
with open("notes.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
Common modes: r read, w write/overwrite, a append, andx create a new file.
14. OOP Basics (Class और Object)
Object-Oriented Programming में class एक blueprint है और object उसका instance होता है।
class Student:
def __init__(self, name):
self.name = name
def introduce(self):
print("My name is", self.name)
student1 = Student("Aman")
student1.introduce()
OOP के मुख्य concepts: Class, Object, Encapsulation, Inheritance, Polymorphism, और Abstraction.
15. Practice Questions
- दो numbers input लेकर उनका sum print करें।
- Number even है या odd, check करें।
- तीन numbers में largest number निकालें।
- 1 से 10 तक numbers print करें।
- किसी number का multiplication table print करें।
- List में सबसे बड़ा number खोजें।
- String को reverse करने का program लिखें।
- Function बनाकर factorial निकालें।
- Dictionary में student का नाम और marks store करें।
- Text file बनाकर उसमें data write और read करें।
Code अपने browser में चलाने के लिए Online Python Editor इस्तेमाल करें, और interview की तैयारी के लिए Top 100 Python Interview Questions पढ़ें।
16. Quick Revision
print()output दिखाता है।input()user input लेता है।- Variables data store करते हैं।
if/elif/elsedecisions के लिए हैं।forऔरwhileloops repetition के लिए हैं।- List mutable, tuple immutable, set unique values, और dictionary key-value pairs रखती है।
deffunction define करता है।try/exceptexceptions handle करता है।with open()file handling के लिए useful है।- Class से objects बनाए जाते हैं।
📥 Python Notes PDF in Hindi — Free Download
Python के सभी chapters के PDF notes एक ही जगह, बिल्कुल free और हिंदी में।
Python PDF Notes Download करें Python Tutorial खोलेंNext क्या सीखें?
इन notes के बाद modules, OOP, file handling projects, SQL, NumPy, Pandas और Machine Learning की ओर बढ़ें। हर topic के कम से कम 2–3 programs खुद लिखें। आगे के लिए ये guides उपयोगी हैं: MySQL Introduction, Data Analyst Tutorial, AI Engineer Roadmap, और Python Cheat Sheet। Official reference के लिए Python official documentation देखें।
अक्सर पूछे जाने वाले सवाल (FAQ)
Python notes PDF in Hindi: कहाँ से download करें?
PythonHindii पर सभी chapters के free PDF notes PDF Library page पर उपलब्ध हैं।
Python सीखने में कितना समय लगता है?
रोज 1 घंटा practice करने पर basics लगभग 1–2 महीने में सीखे जा सकते हैं। समय आपकी practice पर निर्भर करता है।
क्या Python beginners के लिए आसान है?
हाँ। Python का syntax सरल और English जैसा है, इसलिए इसे पहली programming language के रूप में सबसे अच्छा माना जाता है।
Python सीखने के बाद क्या करें?
छोटे projects बनाएं, फिर SQL, NumPy, Pandas सीखकर Data Analyst या AI/ML की तरफ बढ़ें।
Python Hindii पर Python programming, coding examples, projects, और interview preparation के free resources पाएं। इस पेज को bookmark करें और revise करने के लिए वापस आएं।
Python code likho, run karo aur practice karo — directly browser mein.
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें