Python का परिचय
Written and reviewed by Gagan Bhardwaj · Senior IT Faculty · 15+ years’ experience
Python क्या है?
Python एक high-level, general-purpose programming language है। “High-level” का अर्थ है कि learner processor instructions को सीधे control करने के स्थान पर print(), lists और functions जैसी readable instructions के साथ काम करता है। “General-purpose” का अर्थ है कि language केवल एक field तक सीमित नहीं है—इसी core language से school program, automation script, website, data-analysis notebook या machine-learning project बनाया जा सकता है।
Python readable programming language है जो beginners को problem-solving सीखने और professionals को libraries के बड़े ecosystem के साथ practical software बनाने में मदद करती है।
Python code case-sensitive है: name, Name और NAME तीन अलग identifiers हैं। Source file सामान्यतः .py extension प्रयोग करती है। नए learners को modern Python 3 use करनी चाहिए।
Python क्यों सीखें?
- Readable syntax: code अपेक्षाकृत छोटा और ordinary mathematical या English notation के निकट होता है।
- Fast feedback: beginner छोटा program तुरंत run करके result देख सकता है।
- Strong fundamentals: variables, decisions, loops, functions, collections, files, exceptions और OOP सीखते हैं।
- Large standard library: text, files, dates, mathematics, JSON, databases और testing के modules साथ मिलते हैं।
- Wide ecosystem: third-party packages web, automation, data science, ML और scientific computing support करते हैं।
- Transferable thinking: Python में सीखे algorithms बाद में C, C++, Java या JavaScript में भी काम आते हैं।
केवल syntax याद न करें। Output predict करें, variable values trace करें, हर example बदलें और समझाएँ कि नया output क्यों आया।
Python Program कैसे चलता है?
Python को अक्सर interpreted language कहा जाता है, लेकिन यह short label पूरी प्रक्रिया नहीं बताता। सबसे अधिक उपयोग होने वाले implementation CPython में सामान्य flow है:
- आप
.pyfile में source code लिखते हैं। - CPython syntax check करके source को प्रायः bytecode नाम के intermediate form में compile करता है।
- Python virtual machine उस bytecode को execute करती है।
- Imported modules का cached bytecode
__pycache__folder में हो सकता है।
यह प्रक्रिया automatic है; beginner सामान्यतः source file सीधे run करता है। PyPy जैसे दूसरे implementations अलग execution techniques प्रयोग कर सकते हैं।
Python Install और Run करें
- python.org/downloads या approved package manager से supported Python 3 install करें।
- Windows installer में option मिले तो Add Python to PATH चुनें।
- Command Prompt, PowerShell या Terminal में version check करें।
python --version # Linux/macOS पर अक्सर python3 --version # Windows Python Launcher py --version
जो command Python 3 version दिखाए उसे use करें। Illustrated steps के लिए Python Setup: Windows, VS Code and IDLE पढ़ें।
Interactive shell और script
| Method | Best use | Example |
|---|---|---|
| Interactive shell | एक expression तुरंत test करना | >>> 7 * 8 |
| Script file | Complete program save और re-run करना | python first.py |
Program 1: पहला Output
print("Hello, I am learning Python!")
print("CodingEasily makes concepts clear.")print()built-in function values को standard output पर भेजता है।- Quotes के अंदर text एक string है।
- हर
print()call default रूप से newline पर समाप्त होती है। - Python statement के अंत में सामान्यतः semicolon नहीं लिखा जाता।
Program 2: Input, Conversion और Calculation
name = input("Student name: ")
marks = float(input("Marks out of 100: "))
percentage = marks
print("Student:", name)
print("Percentage:", percentage, "%")input() text लौटाता है। float(...) marks को number में convert करता है। Invalid numeric input पर ValueError आता है; exception handling आगे पढ़ेंगे।
Essential Syntax और Indentation
score = 72
if score >= 40:
print("Pass")
print("Well done")
else:
print("Needs improvement")- Colon
ifयाelseका block आरंभ करता है। - Indentation Python syntax का भाग है और block define करती है।
- हर indentation level के लिए चार spaces standard style है।
- Tabs और spaces मिलाने से error या misleading alignment हो सकती है।
- Hash sign normal single-line comment शुरू करता है:
# explanation।
Detailed lesson: Python Syntax, Indentation and Comments.
मुख्य Data Types का Preview
| Type | Example | Meaning |
|---|---|---|
int | age = 16 | Whole number |
float | price = 49.5 | Floating-point number |
str | city = "Khurja" | Unicode text |
bool | is_present = True | True या False |
list | marks = [78, 85, 91] | Ordered, mutable collection |
tuple | point = (4, 7) | Ordered, immutable sequence |
dict | {"name": "Aarav"} | Key-value mapping |
Python dynamically typed है: variable name एक declared type से permanently restricted नहीं है। फिर भी हर value का type होता है। आगे Variables and Data Types पढ़ें।
Python कहाँ Use होती है?
| Area | Typical work | Examples |
|---|---|---|
| Automation | Files rename, reports, CSV/JSON processing | Standard library, openpyxl |
| Web development | Server applications और APIs | Django, Flask, FastAPI |
| Data analysis | Data clean, transform और visualise | NumPy, pandas, Matplotlib |
| AI और ML | Models train, evaluate और use | scikit-learn, PyTorch, TensorFlow |
| Scientific computing | Simulation, statistics और research | SciPy, Jupyter |
| Education | Algorithms, projects, CT | IDLE, notebooks |
Library एक tool है, language नहीं। पहले core Python सीखें; फिर problem के अनुसार library चुनें।
Python की Important Features
- Readable: indentation blocks को visually organise करती है।
- Multi-paradigm: procedural, OOP और functional styles support करती है।
- Automatic memory management: routine allocation runtime handle करता है।
- Cross-platform: portable code major OS पर चल सकता है, पर dependencies को test करना पड़ता है।
- Extensible: C/C++ libraries और external systems से interact कर सकती है।
- Open source: CPython और standard library openly develop होते हैं।
Strengths और Limitations
| Strength | Practical limitation |
|---|---|
| Concise development | Tests/type checking न हो तो dynamic type errors runtime पर आ सकते हैं। |
| Rich packages | Packages carefully select, update और secure करने होते हैं। |
| Excellent scripting/data tools | कुछ CPU-intensive work में pure Python compiled native code से धीमी हो सकती है। |
| Many platforms | Desktop packaging, mobile deployment और OS-specific behaviour में extra tools लग सकते हैं। |
Language choice engineering decision है। Readability, development speed और libraries महत्वपूर्ण हों तो Python उत्कृष्ट है; real-time control, tiny embedded systems या maximum native performance के लिए lower-level language बेहतर हो सकती है।
संक्षिप्त और सही इतिहास
- Guido van Rossum ने ABC language से प्रभावित होकर Python पर काम शुरू किया।
- पहला public Python release 1991 में आया।
- नाम comedy group Monty Python से inspired था, snake से नहीं।
- Python 3.0 2008 में release हुई और कुछ पुराने design decisions सुधारे गए।
- Python 2 का end of life 2020 में हुआ; नया development Python 3 पर करें।
Recommended Learning Roadmap
- Python, IDLE और VS Code setup
- Syntax, indentation और comments
- Variables और data types
- Input/output और operators
- Conditions और loops
- Functions, collections, files और exceptions
- Goal के अनुसार OOP, testing, projects, data science और AI
अभ्यास और Self-Check
- अपना नाम, class और city अलग lines में print करें।
- Length और breadth लेकर rectangle का area display करें।
- Five subjects के marks लेकर total और average display करें।
print(type(5 / 2))का output predict करके run करें और कारण समझाएँ।- Pass/fail program को boundary values 39, 40 और 41 से test करें।
अपनी समझ जाँचें
Q1. input() क्या लौटाता है? उत्तर: string। Q2. Normal comment कौन-सा symbol शुरू करता है? उत्तर: #। Q3. Indentation क्यों महत्वपूर्ण है? उत्तर: यह code block define करती है और syntax का भाग है।
Authoritative संदर्भ
- Python 3 Tutorial — official documentation
- Python Language Reference — official documentation
- Python General FAQ — history और implementation
- PEP 8 — Python Code Style Guide
- Python.org — supported downloads
इन references को 14 August 2026 को review किया गया। Explanation और examples CodingEasily learners के लिए original रूप से लिखे गए हैं।
सारांश
- Python readable, high-level और general-purpose language है।
- CPython सामान्यतः source को bytecode में compile करके virtual machine में execute करता है।
- Indentation blocks define करती है और Python dynamically typed है।
- Python education, automation, web, data science, scientific work और AI support करती है।
- Python 3 use करें, programs बदलकर practise करें और roadmap क्रम से पूरा करें।