🟢 Beginner · Lesson 01
Python का परिचय
Python क्या है?
Python एक high-level, general-purpose programming language है जिसे Guido van Rossum ने 1991 में बनाया। यह अपनी साफ, English जैसी syntax के लिए जानी जाती है जो पढ़ने-लिखने में आसान है — इसीलिए CBSE Class 11/12 और ज़्यादातर B.Tech courses में इसे पहली language के रूप में सुझाया जाता है।
💡 एक line में
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
Python – first.py
print("Hello, I am learning Python!")Hello, I am learning Python!
print()एक built-in function है जो screen पर text दिखाता है।- Quotes के अंदर का text एक string है।
- अंत में semicolon की ज़रूरत नहीं — Python line break use करता है।
Program 2: छोटा Calculator
Python – add.py
a = 10
b = 5
print("Sum :", a + b)
print("Diff :", a - b)
print("Product :", a * b)
print("Divide :", a / b)Sum : 15
Diff : 5
Product : 50
Divide : 2.0
- 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 करें।
💻 लाइव कोड एडिटर
इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.