Python परिचय
In this page:
Python क्या है?
Python एक high-level, general-purpose programming language है, जो अपनी पढ़ने में आसान, लगभग अंग्रेज़ी जैसी syntax के लिए जानी जाती है। इससे आप C++ या Java जैसी भाषाओं की तुलना में कम lines में अपने विचार व्यक्त कर सकते हैं।
यह code को पहले से machine code में compile करने के बजाय एक interpreter पर चलती है, इसीलिए इसे अक्सर शुरुआती लोगों के लिए पहली भाषा के रूप में सुझाया जाता है।
उदाहरण: What is Python?
# Python: readable, near-English syntax
name = "Alex"
print("Hello,", name)
Python क्यों सीखें?
Python की साफ़-सुथरी syntax और तैयार libraries के विशाल ecosystem का मतलब है कि आप अपनी असली समस्या हल करने में ज़्यादा समय लगाते हैं और भाषा से जूझने में कम।
आसानी से सीखने और गंभीर production-स्तर की शक्ति का यही मेल इसे शुरुआती और पेशेवर engineers, दोनों के लिए सबसे ज़्यादा माँग वाले skills में से एक बनाए रखता है।
उदाहरण: Why Learn Python?
# Import the statistics module for calculations like mean()
import statistics
scores = [88, 92, 79, 95] # list of four test scores
print(statistics.mean(scores)) # compute and print the average score
Python कैसे काम करती है
क्योंकि Python interpreted है, interpreter पूरे program को पहले binary में compile करने के बजाय आपकी source file को एक-एक statement करके पढ़ता और चलाता है।
इससे प्रयोग करते समय edit-run-fix का चक्र बहुत तेज़ हो जाता है, हालाँकि इसका मतलब यह भी है कि भारी गणना (number-crunching) में Python programs आमतौर पर compiled भाषाओं से धीमे चलते हैं।
उदाहरण: How Python Works
print("Step 1")
print("Step 2")
print("Step 3")
# Each line runs immediately, in order -- no separate compile step
Python के उपयोग
Python का उपयोग असाधारण रूप से व्यापक कामों में होता है: web backends के लिए Django और Flask, data science और machine learning के लिए NumPy/Pandas/scikit-learn, scraping और automation के लिए requests और BeautifulSoup, और cloud infrastructure scripting के लिए boto3 या ऐसे ही SDKs।
उदाहरण: Applications of Python
# Django/Flask: web backends
# NumPy, Pandas, scikit-learn: data science & ML
# requests, BeautifulSoup: scraping & automation
# boto3: cloud infrastructure scripting
print("Python powers web, data science, scraping, and cloud tools")
Python के फ़ायदे
Python Windows, macOS और Linux के लिए official installers देती है, इसलिए एक ही script आमतौर पर बिना बदलाव के सभी platforms पर चल जाती है।
किसी भी भाषा के सबसे बड़े open-source समुदायों में से एक के साथ जुड़कर, इस portability का मतलब है कि लगभग हर समस्या के जवाब, packages और tutorials बस एक search की दूरी पर हैं।
उदाहरण: Benefits of Python
import platform # module to get info about the operating system
print("Running on:", platform.system()) # print the current OS name
print("Same script runs on Windows, macOS, and Linux") # message emphasizing cross-platform support
Chapter Quiz — Complete all 14 topics to unlock
0/14 topics done
Complete these topics first: