Introduction to Python
Python का परिचय
What is Python?
Python is a high-level, general-purpose programming language created by Guido van Rossum in 1991. It is known for clean, English-like syntax that is easy to read and write — which is why it is the recommended first language in CBSE Class 11/12 and most B.Tech courses.
Python lets you write less code to do more work. A task that needs 10 lines in C or Java often needs just 2-3 lines in Python.
Why Python is So Popular
- Simple syntax — reads almost like English.
- Beginner-friendly — no semicolons, no type declarations.
- Huge libraries — NumPy, Pandas, Django, TensorFlow ready to use.
- Cross-platform — same code runs on Windows, Linux, Mac.
- In demand — used in AI, data science, web and automation jobs.
Where Python is Used
| Field | Example |
|---|---|
| Data Science & AI | Pandas, scikit-learn, TensorFlow |
| Web Development | Django, Flask |
| Automation / Scripting | File handling, web scraping |
| Apps & Games | Tkinter, PyGame |
Program 1: Your First Line
print("Hello, I am learning Python!")print()is a built-in function that shows text on screen.- The text inside quotes is a string.
- No semicolon needed at the end — Python uses the line break.
Program 2: A Tiny Calculator
a = 10
b = 5
print("Sum :", a + b)
print("Diff :", a - b)
print("Product :", a * b)
print("Divide :", a / b)- Variables
aandbhold numbers. + - * /are arithmetic operators.- Notice
/gives2.0(a float) — Python division always returns a decimal.
Key Features
- Interpreted — runs line by line, no separate compile step.
- Dynamically typed — no need to declare variable types.
- Object-oriented — supports classes and objects.
- Free & open-source.
Short History
Python was created by Guido van Rossum and released in 1991. The name comes from the comedy group "Monty Python", not the snake. Python 3 (released 2008) is the modern version used today.
Common Mistakes
- Installing/using old Python 2 instead of Python 3.
- Forgetting quotes around text in
print(). - Mixing tabs and spaces for indentation.
Practice Tasks
- Print your name and class on two separate lines.
- Store two numbers and print all four arithmetic results.
- Print a small paragraph about why you want to learn Python.
Summary
- Python is a simple, high-level, interpreted language.
- Used in AI, data science, web and automation.
print()displays output; no semicolons needed.- Always use Python 3.
Python क्या है?
Python एक high-level, general-purpose programming language है जिसे Guido van Rossum ने 1991 में बनाया। यह अपनी साफ, English जैसी syntax के लिए जानी जाती है जो पढ़ने-लिखने में आसान है — इसीलिए CBSE Class 11/12 और ज़्यादातर B.Tech courses में इसे पहली language के रूप में सुझाया जाता है।
Python में कम code लिखकर ज़्यादा काम होता है। जो काम C या Java में 10 lines लेता है, वह Python में अक्सर 2-3 lines में हो जाता है।
Python इतनी Popular क्यों है
- Simple syntax — लगभग English जैसी पढ़ी जाती है।
- Beginner-friendly — न semicolons, न type declarations।
- बड़ी libraries — NumPy, Pandas, Django, TensorFlow तैयार।
- Cross-platform — एक ही code Windows, Linux, Mac पर चलता है।
- Demand में — AI, data science, web और automation jobs में।
Python कहाँ Use होती है
| Field | Example |
|---|---|
| Data Science & AI | Pandas, scikit-learn, TensorFlow |
| Web Development | Django, Flask |
| Automation / Scripting | File handling, web scraping |
| Apps & Games | Tkinter, PyGame |
Program 1: आपकी पहली Line
print("Hello, I am learning Python!")print()एक built-in function है जो screen पर text दिखाता है।- Quotes के अंदर का text एक string है।
- अंत में semicolon की ज़रूरत नहीं — Python line break use करता है।
Program 2: छोटा Calculator
a = 10
b = 5
print("Sum :", a + b)
print("Diff :", a - b)
print("Product :", a * b)
print("Divide :", a / b)- Variables
aऔरbnumbers रखते हैं। + - * /arithmetic operators हैं।- ध्यान दें
/2.0(float) देता है — Python division हमेशा decimal लौटाता है।
मुख्य Features
- Interpreted — line by line चलती है, अलग compile step नहीं।
- Dynamically typed — variable types declare करने की ज़रूरत नहीं।
- Object-oriented — classes और objects support करती है।
- Free व open-source।
छोटा इतिहास
Python को Guido van Rossum ने बनाया और 1991 में release किया। नाम comedy group "Monty Python" से आया, साँप से नहीं। Python 3 (2008) आज use होने वाला modern version है।
सामान्य गलतियाँ
- Python 3 की जगह पुराना Python 2 use करना।
print()में text के around quotes भूलना।- Indentation में tabs और spaces मिलाना।
Practice Tasks
- अपना नाम और class दो अलग lines में print करें।
- दो numbers store करके चारों arithmetic results print करें।
- आप Python क्यों सीखना चाहते हैं, उस पर छोटा paragraph print करें।
सारांश
- Python एक simple, high-level, interpreted language है।
- AI, data science, web और automation में use होती है।
print()output दिखाता है; semicolons की ज़रूरत नहीं।- हमेशा Python 3 use करें।