Python › Programming Fundamentals

What programming actually is

5 min read Beginner 6 sections

Let’s start with the honest version: a program is just a list of precise instructions a computer follows in order. That’s it. Code is text that describes those instructions in a language the machine can run. Everything else you’ll ever learn is detail on top of that one idea.

You’re not here to become a software developer, and this course never pretends otherwise. You’re here to automate the things you already do by hand and to read the tools you already use. That changes what matters — and it’s why we start with Python.

You'll learn to

  • Explain what a program is in one sentence
  • Run Python two different ways and know when to use each
  • Read your own privilege context on a Linux box

Why Python, specifically

Python reads almost like English, runs on every platform, and has a library for nearly everything in security. That last part is the real reason: most offensive tooling you’ll ever touch — impacket, scapy, sqlmap, pwntools, and thousands of recon scripts — is written in it. Learn Python and you can read, change, and extend the tools instead of just running them.

You’ll be productive in hours, not months. That’s not a sales pitch; it’s a property of the language.

How Python runs your code

Python is interpreted. You write a plain text file ending in .py, and the Python interpreter reads it top to bottom, running each line as it goes. There’s no separate “compile” step to wait on — you write, you run, you see the result.

There are two ways to run it, and you’ll use both.

# hello.py  — run it with:  python3 hello.py
print("hello")          # print() shows text on screen
# Lines starting with # are comments — notes for humans, ignored by Python.

That’s a script: a file you run. The other way is the REPL — type python3 with no file and you get an interactive prompt where you run one line at a time. The REPL is your scratchpad. Test a single idea there, then move it into a script once it works.

Your first useful commands

Forget “hello world” for a second. Here are four commands that matter on every Linux system you’ll ever touch:

# These are shell commands, but you'll automate them with Python soon.
# whoami   → which user am I?
# id       → my user id, group id, and every group I belong to
# hostname → what is this machine called?
# uname -a → what kernel and OS is this?

The point isn’t the commands themselves — it’s the instinct. The first thing you do on any system is establish who you are and where you are. We’ll automate exactly this kind of situational awareness later in the course.

A common first stumble

The single most common beginner mistake isn’t in the code — it’s running the wrong Python. Many systems have both python (often old Python 2) and python3. Always use python3 unless you know otherwise.

Try it yourself

Open a terminal and run python3 to enter the REPL. Type print("ready") and press Enter. Then type 2 ** 10 and watch it answer 1024. You’ve just run two programs. Type exit() to leave.

Summary

A program is an ordered list of instructions. Python runs them line by line, with no compile step. You run code as a script (python3 file.py) or interactively in the REPL. Python is the right first language for security work because the tools you’ll use are written in it — fluency means you can read and extend them.

Key takeaways

  • A program is just precise instructions in order — don’t overcomplicate it.
  • Use the REPL to experiment, scripts to keep things.
  • Always run python3, not python.
  • The “who am I, where am I” reflex starts now and gets automated later.

Quick quiz

Next up, we give those instructions something to remember: variables and the handful of data types you’ll use constantly.

Was this lesson helpful?