Beginner

Introduction to Python

Discover what Python is, where it came from, why it dominates modern programming, and how to write your very first line of code.

What is Python?

Python is a high-level, interpreted, general-purpose programming language known for its clear syntax, readability, and versatility. It lets you build everything from simple scripts to complex web applications and machine learning models.

Python emphasizes code readability and uses indentation (whitespace) to define code blocks rather than curly braces or keywords, making it one of the easiest languages to learn and read.

A Brief History

Python was created by Guido van Rossum and first released in 1991. The name was inspired by the British comedy group Monty Python, not the snake.

  • 1991: Python 0.9.0 released with classes, functions, exception handling, and core data types.
  • 2000: Python 2.0 introduced list comprehensions, garbage collection, and Unicode support.
  • 2008: Python 3.0 launched with breaking changes to fix fundamental design flaws.
  • 2020: Python 2 reached end-of-life — all new projects should use Python 3.
  • Today: Python consistently ranks as the #1 most popular programming language.

Why Python?

Key advantages: Simple and readable syntax, massive ecosystem of libraries, huge community, cross-platform compatibility, and excellent for both beginners and professionals.
  1. Simple Syntax

    Python reads almost like English. You can accomplish more with fewer lines of code compared to languages like Java or C++.

  2. Versatile

    Web development, data science, AI/ML, automation, scripting, DevOps, game development — Python does it all.

  3. Huge Ecosystem

    Over 400,000 packages on PyPI (Python Package Index) covering every domain imaginable.

  4. Community & Support

    One of the largest developer communities means answers to nearly every question already exist online.

Python 2 vs Python 3

FeaturePython 2Python 3
StatusEnd-of-life (Jan 2020)Actively maintained
Printprint "hello"print("hello")
Division5/2 = 2 (integer)5/2 = 2.5 (float)
StringsASCII by defaultUnicode by default
Rangerange() returns a listrange() returns an iterator
Always use Python 3. Python 2 has been officially deprecated since January 1, 2020. All new projects must use Python 3.x (currently 3.12+).

Where Python is Used

🌐

Web Development

Django, Flask, and FastAPI power millions of websites and APIs worldwide.

📊

Data Science

Pandas, NumPy, and Matplotlib are the backbone of data analysis workflows.

🤖

AI & Machine Learning

TensorFlow, PyTorch, and Scikit-learn make Python the #1 language for AI.

Automation & Scripting

Automate repetitive tasks, web scraping, system administration, and DevOps pipelines.

Your First Python Program

The classic "Hello, World!" program in Python is just one line:

Python
print("Hello, World!")

That's it. No boilerplate, no imports, no class definitions. Just one clear line of code.

The Python REPL

Python includes an interactive REPL (Read-Eval-Print Loop) that lets you execute code line by line — perfect for experimenting and learning:

Terminal
$ python3
Python 3.12.0 (main, Oct  2 2024)
>>> print("Hello from the REPL!")
Hello from the REPL!
>>> 2 + 3
5
>>> name = "Python"
>>> print(f"Welcome to {name}!")
Welcome to Python!
>>> exit()
💡
Tip: Open your terminal right now and type python3 (or python on Windows) to start the REPL. Try some arithmetic expressions and print statements to get comfortable.