Example 1 — Hello, World!
print("Hello, World!") 
This page is a self-contained introduction to Python—one of the world’s most popular programming languages. You will understand what Python is, who created it, and write your first programs in minutes.
Language overview.
Guido van Rossum.
CPython & C.
First program.
Where it shines.
Hands-on code.
Python is a popular high-level, interpreted programming language widely used for general-purpose programming, scientific computing, data analysis, web development, automation, and artificial intelligence.
It was first released in 1991 and has become one of the most widely used languages in the world. Python is known for its simplicity, readability, and ease of use, making it a favorite among beginners and experienced developers alike.
A large, active community maintains Python itself and thousands of libraries on PyPI—from NumPy and pandas for data science to Django and Flask for web apps.
Python uses indentation (spaces) to define code blocks instead of curly braces. Keep indentation consistent—usually four spaces per level.
Guido van Rossum is considered the father of Python. He created the language in the late 1980s and released the first version in 1991 while working at the Centrum Wiskunde & Informatica (CWI) in the Netherlands.
The name comes from the British comedy group Monty Python—not the snake. Guido served as Python’s “Benevolent Dictator For Life” (BDFL) for decades before stepping down; development continues through PEPs and community consensus.
| Event | Year | Highlight |
|---|---|---|
| Python 0.9.0 | 1991 | First public release by Guido van Rossum |
| Python 2.0 | 2000 | List comprehensions, garbage collection |
| Python 3.0 | 2008 | Modern Unicode-first design |
| Python 2 EOL | 2020 | Python 2 no longer maintained |
| Python 3.12+ | 2023+ | Faster CPython, improved error messages |
The reference implementation, CPython, is mostly written in C. Parts of the standard library use C, C++, and Python itself. When CPython is built, Python source is compiled to bytecode, and the C runtime executes it on your machine.
Alternative implementations exist—PyPy (JIT-focused), Jython (JVM), IronPython (.NET)—but CPython from python.org is what most learners and production systems use.
Download Python 3 from python.org, then verify and run a script:
python --version
python demo.py python or python3 — starts the interpreter (platform-dependent name)pip install requests — installs packages from PyPIpython -m venv .venv — creates an isolated virtual environment per projectHere is a simple Python program that prints Hello, World! to the console:
print("Hello, World!") Save the file as demo.py and run python demo.py. The print() function sends text to the terminal. No semicolons required.
Python is widely used across industries and fields:
| Concept | What it does |
|---|---|
| Variables | name = "Alex" — no type keyword needed |
| Data types | str, int, float, bool, list, dict |
| Indentation | Defines blocks after if, for, def |
| Functions | def greet(): reusable named blocks |
| Modules | import math share code across files |
| pip / venv | Install packages and isolate project dependencies |
| Task | Python code |
|---|---|
print("Hi") | |
| Variable | age = 20 |
| Condition | if x > 0: |
| Loop | for i in range(5): |
| Function | def add(a, b): return a + b |
| Comment | # line comment |
Five starter programs. Save each as a .py file and run with python filename.py, or paste into the interactive REPL.
print("Hello, World!") name = "Alex"
age = 20
is_student = True
print("Name:", name)
print("Age:", age)
print("Student:", is_student) language = "Python"
version = 3.12
print(f"Welcome to {language} {version}!") Prefix a string with f to embed variables inside {curly braces}.
n = 7
if n % 2 == 0:
print(f"{n} is even")
else:
print(f"{n} is odd") Notice the colon and indented block—indentation is part of Python syntax.
total = 0
for i in range(1, 6):
total += i
print("Sum 1..5 =", total) Save human-readable .py files with functions, classes, and statements.
The interpreter parses code into bytecode (.pyc caches may be created).
The PVM executes bytecode line by line, calling C extensions and your functions.
print() writes to the terminal; files, APIs, or GUIs receive other results.
print(), variables, if/for, and functions.pip freeze > requirements.txt to track dependenciesprint "hi" without parentheses)NameError and IndentationError messages—they pinpoint the fix.venv) to git unnecessarilyPython has a Zen philosophy. Its design is guided by principles called The Zen of Python, which emphasize simplicity, readability, and practicality. Open a Python shell and type import this to read them—including the famous line: “Readability counts.”
Install Python 3, save the Hello World example, and run it from your terminal.
11 people found this page helpful