What Is Programming? 🧑🍳Programming क्या है? 🧑🍳什么是编程?🧑🍳
A computer is a chef that is incredibly fast and never tired, but has no common sense at all. It does exactly what you write — nothing more, nothing less. Programming is writing that recipe, called a program, in a language the computer understands.
Computer एक ऐसा chef है जो बहुत तेज़ है और कभी थकता नहीं, पर उसमें बिल्कुल भी common sense नहीं। वह ठीक वही करता है जो आप लिखते हैं — न ज़्यादा, न कम। Programming वह recipe लिखना है, जिसे program कहते हैं, ऐसी भाषा में जिसे computer समझे।
计算机就是这样一位厨师:极快、永不疲倦,却完全没有常识。它严格按你写的做 —— 不多也不少。编程就是用计算机能理解的语言写下这份菜谱,也就是程序。
Programming (or coding) means designing, writing, testing and maintaining instructions that a computer follows to do a task. The instructions are written in a programming language — a language with strict rules (its syntax) that sits between human ideas and what the machine can execute.
Programming (या coding) का मतलब है ऐसे निर्देश design करना, लिखना, test करना और संभालना जिन्हें computer किसी काम के लिए follow करे। ये निर्देश programming language में लिखे जाते हैं — सख़्त नियमों (उसका syntax) वाली भाषा जो इंसानी विचार और machine के बीच पुल है।
编程(也叫写代码)就是设计、编写、测试和维护让计算机完成任务的指令。这些指令用编程语言写成 —— 一种规则严格(即语法)的语言,连接人的想法与机器能执行的操作。
Press Step to run one line at a time. Watch the variables (the computer's memory) and the output. Change qty and run again.
एक बार में एक line चलाने के लिए Step दबाएँ। Variables (computer की memory) और output देखें। qty बदलें और फिर चलाएँ।
点击“单步”一次运行一行。观察变量(计算机的内存)和输出。改变 qty 再运行一次。
Every app on your phone, every website, every game and every recommendation you see exists because someone wrote a program. Programming is how ideas become working software.
आपके phone का हर app, हर website, हर game और हर recommendation इसलिए है क्योंकि किसी ने program लिखा। Programming वह तरीका है जिससे विचार चलता हुआ software बनते हैं।
你手机上的每个应用、每个网站、每款游戏、看到的每条推荐,都是因为有人写了程序。编程就是把想法变成可用软件的方式。
How Programming Works — The Big PictureProgramming कैसे काम करती है — बड़ी तस्वीर编程如何进行 —— 全局视图
What Is Python? 🐍Python क्या है? 🐍什么是 Python?🐍
Python is a high-level, general-purpose programming language designed to be easy to read. Where many languages use curly braces and semicolons, Python uses indentation (spaces at the start of a line) to group code, so programs look close to plain English.
Python एक high-level, general-purpose programming language है जो पढ़ने में आसान होने के लिए बनी है। जहाँ कई भाषाएँ curly braces और semicolons इस्तेमाल करती हैं, Python code को group करने के लिए indentation (line की शुरुआत में spaces) इस्तेमाल करता है, इसलिए programs लगभग सादी अंग्रेज़ी जैसे दिखते हैं।
Python 是一种高级、通用的编程语言,设计目标是易读。许多语言用花括号和分号,而 Python 用缩进(行首的空格)来组织代码,所以程序读起来接近普通英语。
Two tiny files with a mistake on line 3. Pick one and press python3. The output is real.
दो छोटी files, दोनों की line 3 में ग़लती। एक चुनें और python3 दबाएँ। Output असली है।
两个小文件,第 3 行都有错误。选一个,点击 python3。输出是真实的。
Want to see the bytecode? The dis module shows the simple instructions Python's virtual machine runs for one line of code:
Bytecode देखना है? dis module दिखाता है कि code की एक line के लिए Python की virtual machine कौन से सरल निर्देश चलाती है:
想看看字节码吗?dis 模块会显示 Python 虚拟机为一行代码执行的简单指令:
import dis
dis.dis(compile('total = price * qty', '<demo>', 'exec'))
Type import this in Python to read the Zen of Python, 19 short lines by Tim Peters. It starts "Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex." and includes "There should be one — and preferably only one — obvious way to do it."
Python में import this लिखें और Tim Peters की 19 छोटी lines, Zen of Python, पढ़ें। यह शुरू होता है "Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex." से और इसमें "There should be one — and preferably only one — obvious way to do it." भी है।
在 Python 中输入 import this,就能读到 Tim Peters 写的 19 句《Python 之禅》。开头是 “Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex.”,其中还有 “There should be one — and preferably only one — obvious way to do it.”
Python vs Other Languages — Hello, World!Python बनाम दूसरी भाषाएँ — Hello, World!Python 与其他语言 —— Hello, World!
Every program below was compiled or run and printed Hello, World! (Java 25 needs a newer JDK than our test machine had.)
नीचे का हर program compile या run हुआ और Hello, World! छपा। (Java 25 को हमारी test machine से नया JDK चाहिए।)
下面每个程序都编译或运行过,并打印出 Hello, World!(Java 25 需要比我们测试机更新的 JDK。)
Who Created Python? 👨💻Python किसने बनाया? 👨💻Python 是谁创造的?👨💻
He named it after the British comedy show Monty Python's Flying Circus — not the snake. Version 0.9.0 was posted publicly in February 1991, already with classes, functions, exceptions, lists and dictionaries.
Guido led the language as its "Benevolent Dictator For Life" until he stepped down in July 2018. Since 2019 Python has been guided by a five-person Steering Council elected by the core developers.
उन्होंने इसका नाम British comedy show Monty Python's Flying Circus पर रखा — साँप पर नहीं। Version 0.9.0 February 1991 में सार्वजनिक हुआ, जिसमें पहले से classes, functions, exceptions, lists और dictionaries थे।
Guido ने July 2018 में हटने तक "Benevolent Dictator For Life" के रूप में भाषा का नेतृत्व किया। 2019 से Python को core developers द्वारा चुनी गई पाँच लोगों की Steering Council चलाती है।
他用英国喜剧节目 Monty Python's Flying Circus 命名 —— 而不是蟒蛇。0.9.0 版于 1991 年 2 月公开发布,已经具备类、函数、异常、列表和字典。
Guido 以“终身仁慈独裁者”身份领导这门语言,直到 2018 年 7 月卸任。自 2019 年起,Python 由核心开发者选出的五人指导委员会领导。
A new version now comes out every October. Python 3.15.0 was released on 9 October 2026.
अब हर October नया version आता है। Python 3.15.0, 9 October 2026 को release हुआ।
现在每年 10 月发布一个新版本。Python 3.15.0 于 2026 年 10 月 9 日发布。
Benefits of Python 🌟Python के फ़ायदे 🌟Python 的优点 🌟
Advantages and Disadvantages ⚖️फ़ायदे और नुक़सान ⚖️优点与缺点 ⚖️
| # | Disadvantageनुक़सान缺点 |
|---|---|
| 1 | Slower for pure loops — about 164× slower than C in our race belowसादे loops में धीमा — नीचे की दौड़ में C से लगभग 164× धीमा纯循环较慢 —— 在下方比赛中约比 C 慢 164 倍 |
| 2 | GIL — one thread runs Python code at a time in the standard build (a free-threaded build has been officially supported since 3.14)GIL — standard build में एक समय में एक thread Python code चलाता है (3.14 से free-threaded build को आधिकारिक support)GIL —— 标准版本中同一时刻只有一个线程执行 Python 代码(3.14 起自由线程版本获正式支持) |
| 3 | More memory — every value is a full objectज़्यादा memory — हर मान पूरा object है内存占用较多 —— 每个值都是完整对象 |
| 4 | Weak on mobile — few native app frameworksMobile पर कमज़ोर — native app frameworks कम移动端较弱 —— 原生应用框架少 |
| 5 | Type mistakes appear late — at run time (type hints + a checker help)Type ग़लतियाँ देर से दिखती हैं — run time पर (type hints + checker मदद करते हैं)类型错误发现较晚 —— 运行时才出现(类型注解 + 检查工具可帮忙) |
| 6 | Packaging can be confusing — many tools; use venv + pip to startPackaging उलझन भरी हो सकती है — कई tools; शुरुआत venv + pip से打包可能令人困惑 —— 工具很多;入门用 venv + pip |
| # | Advantageफ़ायदा优点 |
|---|---|
| 1 | Simple syntax — reads like pseudocodeसरल syntax — pseudocode जैसा语法简单 —— 读起来像伪代码 |
| 2 | Huge library ecosystem — 736,000+ packagesविशाल library ecosystem — 736,000+ packages库生态庞大 —— 73.6 万+ 个包 |
| 3 | Versatile — web, AI, data, automationबहुमुखी — web, AI, data, automation用途广 —— Web、AI、数据、自动化 |
| 4 | Free and open sourceमुफ़्त और open source免费开源 |
| 5 | Run instantly — no separate build stepतुरंत चलाएँ — अलग build step नहीं即写即运行 —— 无需单独构建 |
| 6 | Glue language — calls C/C++ libraries, databases and web APIsGlue language — C/C++ libraries, databases और web APIs बुलाती है胶水语言 —— 可调用 C/C++ 库、数据库和 Web API |
Four ways to add up 0 … 9,999,999. Times were measured on the machine that built this page (median of several runs); the animation replays them in real time.
0 … 9,999,999 जोड़ने के चार तरीके। समय इस page को बनाने वाली machine पर मापा गया (कई runs का median); animation उन्हें असली समय में दोहराता है।
四种方式累加 0 … 9,999,999。时间在生成本页的机器上测得(多次运行的中位数);动画按真实时间重放。
# speed.py — add up the numbers 0 … 9,999,999 three ways
import time
import numpy as np
N = 10_000_000
t = time.perf_counter()
total = 0
for i in range(N): # Python runs this loop one step at a time
total += i
loop = time.perf_counter() - t
t = time.perf_counter()
total2 = sum(range(N)) # the built-in sum() loops in C
builtin = time.perf_counter() - t
t = time.perf_counter()
total3 = int(np.arange(N).sum()) # NumPy: one C call on a whole array
vec = time.perf_counter() - t
print(f"answer: {total:,} (all three agree: {total == total2 == total3})")
print(f"plain for-loop : {loop:.3f} s")
print(f"built-in sum() : {builtin:.3f} s ({loop / builtin:.0f}× faster)")
print(f"NumPy : {vec:.3f} s ({loop / vec:.0f}× faster)")
A pure Python loop really is much slower than C — here about 164×. But most programs spend their time waiting for files, networks or databases, and developer time usually costs more than computer time. When number-crunching matters, use built-ins and libraries such as NumPy, which run their loops in C: in the race, NumPy closed most of the gap without leaving Python.
सादा Python loop सच में C से बहुत धीमा है — यहाँ लगभग 164×। पर ज़्यादातर programs का समय files, network या databases का इंतज़ार करने में जाता है, और developer का समय आमतौर पर computer के समय से महँगा होता है। जब गणना मायने रखे, तब built-ins और NumPy जैसी libraries इस्तेमाल करें, जो अपने loops C में चलाती हैं: दौड़ में NumPy ने Python छोड़े बिना ज़्यादातर अंतर भर दिया।
纯 Python 循环确实比 C 慢很多 —— 这里约 164 倍。但大多数程序的时间花在等待文件、网络或数据库上,而开发者的时间通常比计算机的时间更贵。需要大量计算时,用内置函数和 NumPy 等库,它们在 C 中执行循环:在比赛中,NumPy 不离开 Python 就弥补了大部分差距。
Why Is Python So Popular? 🚀Python इतना लोकप्रिय क्यों है? 🚀Python 为什么这么流行?🚀
Python has been #1 on the TIOBE Index since October 2021 and is still first in October 2026, though its lead has narrowed over the past year. It also tops IEEE Spectrum's ranking. Several things push it:
Python October 2021 से TIOBE Index पर #1 है और October 2026 में भी पहले स्थान पर है, हालाँकि पिछले साल इसकी बढ़त घटी है। यह IEEE Spectrum की ranking में भी सबसे ऊपर है। इसके पीछे कई कारण हैं:
Python 自 2021 年 10 月起一直位居 TIOBE 指数第 1,2026 年 10 月仍然第一,尽管过去一年领先优势有所缩小。它在 IEEE Spectrum 排行中也名列前茅。推动它的因素有:
Where Is Python Used? 🗺️Python कहाँ इस्तेमाल होता है? 🗺️Python 用在哪里?🗺️
| Domainक्षेत्र领域 | What Python doesPython क्या करता हैPython 做什么 | Key librariesमुख्य libraries主要库 | Examplesउदाहरण例子 |
|---|---|---|---|
| WebWebWeb | Back-end APIs and full web appsBack-end APIs और पूरे web apps后端 API 与完整 Web 应用 | Django, Flask, FastAPI | Instagram, Pinterest, Mozilla |
| Data scienceData science数据科学 | Cleaning, analysis, charts, statisticsसफ़ाई, analysis, charts, statistics清洗、分析、图表、统计 | pandas, NumPy, Matplotlib | Netflix, Spotify |
| AI / machine learningAI / machine learningAI / 机器学习 | Training models, NLP, computer visionModels train करना, NLP, computer vision训练模型、自然语言处理、计算机视觉 | PyTorch, TensorFlow, scikit-learn | Google, Meta, OpenAI |
| AutomationAutomation自动化 | Files, web scraping, reports, testingFiles, web scraping, reports, testing文件处理、网页抓取、报表、测试 | Selenium, Playwright, Beautiful Soup | almost every companyलगभग हर कंपनी几乎每家公司 |
| DevOps / cloudDevOps / cloud运维 / 云 | Infrastructure automation, deploymentInfrastructure automation, deployment基础设施自动化、部署 | Ansible, Boto3 (AWS SDK) | Red Hat (Ansible), AWS |
| GamesGames游戏 | 2D games, prototypes, visual novels2D games, prototypes, visual novels2D 游戏、原型、视觉小说 | Pygame, Panda3D, Ren'Py | indie studios, teachingindie studios, शिक्षण独立工作室、教学 |
| FinanceFinance金融 | Risk analysis, pricing, fraud detectionRisk analysis, pricing, fraud detection风险分析、定价、欺诈检测 | pandas, QuantLib (Python bindings) | banks such as JPMorganJPMorgan जैसे banks摩根大通等银行 |
| ScienceScience科学计算 | Simulations, astronomy, biologySimulations, astronomy, biology模拟、天文、生物 | SciPy, Astropy, Biopython | NASA, CERN |
| Cyber securityCyber security网络安全 | Network tools, testing, forensicsNetwork tools, testing, forensics网络工具、测试、取证 | Scapy, Impacket | security teamssecurity teams安全团队 |
Python is great at connecting things: it can call fast C libraries, talk to web APIs, read spreadsheets, query databases and send emails — all in one short script. That is why it shows up in every field.
Python चीज़ों को जोड़ने में बेहतरीन है: यह तेज़ C libraries बुला सकता है, web APIs से बात कर सकता है, spreadsheets पढ़ सकता है, databases से query कर सकता है और emails भेज सकता है — सब एक छोटी script में। इसीलिए यह हर क्षेत्र में दिखता है।
Python 擅长把各种东西连接起来:调用高速 C 库、访问 Web API、读取电子表格、查询数据库、发送邮件 —— 全在一个简短脚本里。这就是它出现在各个领域的原因。
Installing Python 💻Python Install करना 💻安装 Python 💻
"python is not recognized" or the Microsoft Store opening when you type python means Windows cannot find your Python. With the install manager, use py or rerun its configuration (py install --configure). With the classic installer, rerun it, choose "Modify", and make sure Python is added to PATH.
"python is not recognized" या python लिखने पर Microsoft Store खुलना, मतलब Windows को आपका Python नहीं मिल रहा। Install manager के साथ py इस्तेमाल करें या उसकी configuration दोबारा चलाएँ (py install --configure)। पुराने installer के साथ उसे दोबारा चलाएँ, "Modify" चुनें, और पक्का करें कि Python PATH में जुड़ा हो।
出现 “python is not recognized”,或输入 python 却打开了 Microsoft Store,说明 Windows 找不到你的 Python。使用安装管理器时,请用 py,或重新运行其配置(py install --configure)。使用传统安装程序时,重新运行它,选择 “Modify”,确保把 Python 加入 PATH。
Check your installationInstallation जाँचें检查安装
# macOS / Linux
python3 --version
python3 -m pip --version
# Windows
py --version
py -m pip --version
Choosing an Editor 🧰Editor चुनना 🧰选择编辑器 🧰
An IDE or code editor is where you write, run and debug code. Any of these is a good start:
IDE या code editor वह जगह है जहाँ आप code लिखते, चलाते और debug करते हैं। इनमें से कोई भी अच्छी शुरुआत है:
IDE 或代码编辑器是你编写、运行和调试代码的地方。下面任何一个都是不错的起点:
Start with VS Code + the Python extension. It is free and light, and its built-in Jupyter support gives you notebooks in the same editor when you start data work.
VS Code + Python extension से शुरू करें। यह मुफ़्त और हल्का है, और data का काम शुरू करने पर इसका built-in Jupyter support उसी editor में notebooks देता है।
从 VS Code + Python 扩展开始。它免费、轻量,开始做数据分析时,内置的 Jupyter 支持让你在同一个编辑器里使用笔记本。
Running Your First Python Code ▶️अपना पहला Python Code चलाना ▶️运行你的第一段 Python 代码 ▶️
Method 1 — Interactive mode (the REPL)तरीका 1 — Interactive mode (REPL)方式 1 —— 交互模式(REPL)
The REPL (Read–Eval–Print Loop) runs each line as soon as you press Enter. Type python3 (or py on Windows) and you get the >>> prompt. When you type an expression, the REPL shows its value — strings appear with quotes, because the REPL shows how Python writes the value, not how print would.
REPL (Read–Eval–Print Loop) Enter दबाते ही हर line चलाता है। python3 (या Windows पर py) लिखें और >>> prompt मिलेगा। जब आप कोई expression लिखते हैं, REPL उसका मान दिखाता है — strings quotes के साथ दिखती हैं, क्योंकि REPL दिखाता है कि Python मान को कैसे लिखता है, न कि print कैसे छापेगा।
REPL(读取–求值–输出循环)在你按下回车后立即运行每一行。输入 python3(Windows 上输入 py),就会出现 >>> 提示符。输入表达式时,REPL 会显示它的值 —— 字符串带引号显示,因为 REPL 展示的是 Python 书写该值的方式,而不是 print 的输出。
>>> print("Hello, World!")
Hello, World!
>>> 2 + 3
5
>>> "Python" * 3
'PythonPythonPython'
>>> 10 / 4
2.5
>>> 10 // 4
2
>>> 0.1 + 0.2
0.30000000000000004
>>> name = "Asha"
>>> name.upper()
'ASHA'
The original showed PythonPythonPython without quotes; the real REPL prints 'PythonPythonPython'. And notice 0.1 + 0.2 gives 0.30000000000000004 — computers store decimals in binary, so tiny rounding errors are normal in every language.
मूल में PythonPythonPython बिना quotes के था; असली REPL 'PythonPythonPython' छापता है। और देखें 0.1 + 0.2 से 0.30000000000000004 आता है — computers दशमलव संख्याएँ binary में रखते हैं, इसलिए छोटी rounding ग़लतियाँ हर भाषा में सामान्य हैं।
原文显示的 PythonPythonPython 没有引号;真实的 REPL 打印的是 'PythonPythonPython'。另外注意 0.1 + 0.2 得到 0.30000000000000004 —— 计算机用二进制存储小数,所以微小的舍入误差在所有语言中都很正常。
Method 2 — Script mode (the real way)तरीका 2 — Script mode (असली तरीका)方式 2 —— 脚本模式(正式做法)
For real programs, save your code in a .py file and run the file.
असली programs के लिए code को .py file में save करें और file चलाएँ।
编写正式程序时,把代码保存在 .py 文件中,然后运行这个文件。
# hello.py
name = input("What is your name? ")
age = int(input("How old are you? "))
year = 2026 - age
print(f"Hello, {name}!")
print(f"You were born in {year} or {year - 1}.")
print(f"In 10 years, you'll be {age + 10}!")
python3 hello.py # Windows: py hello.py
Knowing only someone's age and the current year, you cannot know their birth year exactly — it depends on whether their birthday has passed. The original printed "born around 1996"; a program should say only what it can know.
सिर्फ़ उम्र और मौजूदा साल जानकर जन्म का साल ठीक-ठीक नहीं पता चलता — यह इस पर निर्भर है कि उनका जन्मदिन इस साल बीता या नहीं। मूल ने "born around 1996" छापा था; program को वही कहना चाहिए जो वह जान सकता है।
只知道年龄和今年年份,无法确定出生年份 —— 这取决于今年的生日是否已过。原文打印的是“大约生于 1996 年”;程序应该只说它能确定的事。
Method 3 — Inside VS Codeतरीका 3 — VS Code के अंदर方式 3 —— 在 VS Code 中
input().
▶ Run Python File (ऊपर-दाएँ) पर click करें। Output terminal में आता है, जहाँ आप input() के जवाब भी लिख सकते हैं।
点击右上角的 ▶ Run Python File。输出显示在终端中,你也可以在那里输入 input() 的回答。
Virtual Environments 📦Virtual Environments 📦虚拟环境 📦
A virtual environment is a private folder of packages for one project. Project A can use one version of a library while project B uses another, and neither touches the system Python. This avoids the classic "it works on my machine" problem.
Virtual environment एक project के लिए packages का निजी folder है। Project A किसी library का एक version इस्तेमाल कर सकता है और project B दूसरा, और कोई भी system Python को नहीं छूता। इससे "मेरी machine पर तो चलता है" वाली क्लासिक समस्या से बचते हैं।
虚拟环境是某个项目专用的包文件夹。项目 A 可以用某个库的一个版本,项目 B 用另一个版本,两者都不影响系统 Python。这避免了经典的“在我电脑上能跑”的问题。
# create the environment (once per project)
python3 -m venv myproject_env # Windows: py -m venv myproject_env
# activate it
source myproject_env/bin/activate # macOS / Linux
myproject_env\Scripts\activate # Windows Command Prompt
.\myproject_env\Scripts\Activate.ps1 # Windows PowerShell
# install packages and record exact versions
pip install requests==2.32.3
pip freeze > requirements.txt
# leave the environment
deactivate
Create the environment before installing anything, and keep requirements.txt with your code. Anyone can then rebuild the same setup with pip install -r requirements.txt. Don't commit the environment folder itself — add it to .gitignore.
कुछ भी install करने से पहले environment बनाएँ, और requirements.txt अपने code के साथ रखें। तब कोई भी pip install -r requirements.txt से वही setup बना सकता है। Environment folder ख़ुद commit न करें — उसे .gitignore में डालें।
安装任何东西之前先创建环境,并把 requirements.txt 和代码放在一起。任何人都能用 pip install -r requirements.txt 重建同样的环境。不要提交环境文件夹本身 —— 把它加入 .gitignore。
Your First Complete Program 🧮आपका पहला पूरा Program 🧮你的第一个完整程序 🧮
This calculator uses everything above: functions, if/elif, a loop, user input and error handling. One improvement over the original: instead of returning an error message as if it were a number, calculate() raises an error, and main() catches it — so a result is always a number.
यह calculator ऊपर की सारी चीज़ें इस्तेमाल करता है: functions, if/elif, loop, user input और error handling। मूल से एक सुधार: error message को संख्या की तरह लौटाने की जगह calculate() error raise करता है, और main() उसे पकड़ता है — इसलिए नतीजा हमेशा संख्या होता है।
这个计算器用到了上面所有内容:函数、if/elif、循环、用户输入和错误处理。相比原版的一处改进:calculate() 不再把错误信息当作数字返回,而是抛出错误,由 main() 捕获 —— 这样结果永远是数字。
# calculator.py — a small calculator
def calculate(a, b, op):
"""Return a op b, or raise ValueError for a bad operator."""
if op == "+":
return a + b
elif op == "-":
return a - b
elif op == "*":
return a * b
elif op == "/":
if b == 0:
raise ZeroDivisionError("cannot divide by zero")
return a / b
elif op == "**":
return a ** b
else:
raise ValueError(f"unknown operator {op!r}")
def main():
print("=== Python Calculator ===")
print("Operators: + - * / **")
while True:
try:
a = float(input("First number: "))
op = input("Operator: ").strip()
b = float(input("Second number: "))
print(f" {a} {op} {b} = {calculate(a, b, op)}")
except (ValueError, ZeroDivisionError, OverflowError) as err:
print(f" Error: {err}")
if input("Another? (y/n): ").strip().lower() != "y":
print("Goodbye!")
break
if __name__ == "__main__":
main()
python3 calculator.py
Type two numbers and an operator. The highlighted line is the branch that runs; the output matches what Python prints, float formatting and error messages included.
दो संख्याएँ और एक operator लिखें। Highlighted line वह शाखा है जो चलती है; output ठीक वैसा है जैसा Python छापता है, float formatting और error messages समेत।
输入两个数和一个运算符。高亮的行是实际执行的分支;输出与 Python 打印的完全一致,包括浮点格式和错误信息。
Golden Rules for Python Beginners 🏆Python Beginners के सुनहरे नियम 🏆Python 初学者黄金法则 🏆
Five questions on this lesson. Pick an answer to see why.
इस lesson पर पाँच सवाल। जवाब चुनें और कारण देखें।
关于本课的五道题。选择答案查看解释。
A program is a precise recipe, and the computer follows it exactly. Python makes those recipes short and readable: it compiles your whole file to bytecode and then runs it, it is slower than C for raw loops but fast enough for most work (and libraries like NumPy close the gap), and it has a huge ecosystem. Install it, try the REPL, write a .py file, keep each project in its own virtual environment — and write a little code every day.
Program एक सटीक recipe है, और computer उसे ठीक वैसे ही follow करता है। Python इन recipes को छोटा और पढ़ने योग्य बनाता है: यह आपकी पूरी file को bytecode में compile करके चलाता है, सादे loops में C से धीमा है पर ज़्यादातर काम के लिए काफ़ी तेज़ (और NumPy जैसी libraries अंतर भर देती हैं), और इसका ecosystem विशाल है। इसे install करें, REPL आज़माएँ, एक .py file लिखें, हर project को उसके अपने virtual environment में रखें — और रोज़ थोड़ा code लिखें।
程序是一份精确的菜谱,计算机会严格照做。Python 让这些菜谱简短易读:它把整个文件编译成字节码再运行;纯循环比 C 慢,但对大多数工作已足够快(NumPy 等库还能弥补差距);而且生态极其丰富。安装它,试试 REPL,写一个 .py 文件,让每个项目使用自己的虚拟环境 —— 并且每天写一点代码。