What Is Python? Setup, Interpreter and Your First Script
Every time an operations engineer automates a nightly server backup, a data analyst cleans a million-row spreadsheet in seconds or a web service processes an online payment, there is a strong chance Python is running behind the scenes. Python has grown from a simple scripting tool into the primary language for automation, backend engineering, data science and artificial intelligence. This lesson opens a 25-part series that takes you from writing your very first line of code through object-oriented design, concurrency, testing and real-world IT automation.
What Is Python?
Python is a high-level, general-purpose, interpreted programming language created by Guido van Rossum and first released in 1991. The key words are high-level and general-purpose. High-level means you read and write instructions in plain, human-friendly English rather than managing raw computer memory addresses. General-purpose means the language is not restricted to one job: you can use the exact same language to build a web API, query a database, automate cloud infrastructure or train a machine learning model.
How Python Runs Your Code
Computers only understand machine code (binary ones and zeros). Different programming languages bridge the gap between human text and machine instructions in different ways:
- Compiled languages (such as C or Go) translate your entire source code directly into a standalone machine-code file before you run it.
- Interpreted languages (such as Python) use a programme called an interpreter. When you run a Python file, the standard interpreter (called CPython) compiles your code into an intermediate step called bytecode and immediately executes it inside the Python Virtual Machine (PVM).
Because the interpreter handles platform differences for you, the same Python script you write on Windows will run on Linux or macOS without recompiling.
Why Organisations and IT Teams Choose Python
| Without Python automation | With Python in your workflow |
|---|---|
| Engineers manually copy, rename and archive log files every Friday | A 20-line script runs automatically on a schedule with zero human error |
| Large CSV exports crash spreadsheet software or take hours to filter | Scripts process and summarise hundreds of thousands of rows in seconds |
| Teams write complex, hard-to-read shell scripts that only one person understands | Clean, readable syntax makes scripts easy for the whole team to maintain |
| Building custom integrations between tools requires everything to be coded from scratch | Python’s standard library and package ecosystem provide ready-made connectors |
How Python Compares With Other Languages
| Language | Primary Strength | How It Compares With Python |
|---|---|---|
| JavaScript | Runs natively in web browsers and powers interactive front-end interfaces | Essential for browser UIs; Python dominates in data, AI, DevOps scripting and scientific computing |
| Java / C# | Large-scale enterprise systems with strict static typing and high raw execution speed | Faster at raw CPU crunching, but requires significantly more boilerplate code than Python |
| Bash / PowerShell | Quick operating-system command execution and shell pipelines | Great for 10-line shell tasks; Python is much safer and easier to test once logic grows complex |
| SQL | Querying and aggregating relational database tables | Complements Python directly (see Database Integration in Python) |
What You Will Learn in This Series
- Lessons 1 to 5: Foundations—variables, data types, strings, conditionals and loops.
- Lessons 6 to 10: Core data structures (Lists and Tuples, Dictionaries and Sets), comprehensions and reusable functions.
- Lessons 11 to 15: Error handling, file I/O, virtual environments and Object-Oriented Programming (OOP).
- Lessons 16 to 20: Expert internals—generators, decorators,
asyncioconcurrency, memory management andpytest. - Lessons 21 to 25: Real-world engineering—REST APIs, databases, Pandas data analysis, IT automation and interview preparation.
Installing Python and Choosing How to Run It
Always use Python 3 (Python 3.12 or newer is recommended). Python 2 reached end-of-life in 2020 and is no longer supported.
- Download: Visit the official site (
python.org) and download the installer for your operating system, or use your system package manager on Linux/macOS. - Crucial Windows Step: On the first screen of the Windows installer, tick the checkbox labelled "Add python.exe to PATH" before clicking Install. This allows you to run Python from any terminal window.
- Verify Installation: Open your Command Prompt (Windows) or Terminal (macOS/Linux) and run:
python --version
(On macOS and some Linux distributions, use python3 --version instead.)
REPL vs Script Files: Two Ways to Run Code
| Mode | How to Start It | Best Used For |
|---|---|---|
| Interactive Shell (REPL) | Type python in your terminal and press Enter (you will see >>>) |
Testing a quick one-line expression, checking how a function works or using Python as a calculator. Type exit() to leave. |
Script File (.py) |
Save code in a file such as app.py and run python app.py |
Real programmes, automation scripts and multi-line code you want to save, version-control and reuse. |
A Short Example: Your First Practical Script
Instead of printing a meaningless phrase, let us write a short script that checks the status of an IT service response time. Create a file named health_check.py in any text editor (such as VS Code) and add the following lines:
# health_check.py - A simple service summary script
service_name = "Customer Portal API"
response_time_ms = 185
print("Checking service:", service_name)
print(f"Current response time: {response_time_ms} ms")
print("Check completed successfully.")
Open your terminal in the same folder and execute the file:
python health_check.py
Output:
Checking service: Customer Portal API
Current response time: 185 ms
Check completed successfully.
Notice three things right away: lines starting with # are comments ignored by Python, statements do not require semicolons at the end of each line, and print() displays output directly to your console.
Common Myths
- “Python is only for beginners.” Some of the largest distributed platforms in the world—including YouTube, Instagram, Spotify and Netflix—rely heavily on Python in production.
- “Python is too slow for real work.” While raw loops in Python are slower than C++, real-world applications spend most of their time waiting on networks or databases, and high-speed Python libraries (like NumPy) execute heavy math in compiled C code under the hood.
- “You need an expensive IDE to write Python.” A free editor like VS Code or even a plain text editor plus a terminal is all you need.
Common Mistakes
- Forgetting to add Python to PATH on Windows: If your terminal says
'python' is not recognized, re-run the installer, choose Modify and tick the PATH option. - Typing terminal commands inside the Python REPL: If your prompt shows
>>>, you are already inside Python. Runningpython health_check.pyinside>>>will trigger aSyntaxError. Typeexit()first to return to your normal operating system terminal. - Adding leading spaces by accident: Unlike many languages, Python uses indentation (spaces at the start of a line) to group code blocks. Never indent a line unless you are inside a block such as an
ifstatement, loop or function.
- Python is a high-level, interpreted language prized for readability, rapid development and a massive library ecosystem.
- The interactive REPL (
>>>) is for quick experiments;.pyscript files are for real, reusable programmes. - Python executes code top-to-bottom and uses clean line breaks and indentation instead of curly braces and semicolons.
- Start with Python 3, verify your PATH setup in the terminal and run every example yourself as you progress through the series.