Python Zero to Advanced #1: Introduction & Setup
Welcome to Python Zero to Advanced, a 10-part series that takes you from your very first line of code to writing tested, type-hinted, asynchronous Python. In this first part we set up a working environment and get comfortable with the two ways of running Python: the interactive REPL and script files.
What is Python and why learn it?
Python is a general-purpose, high-level programming language created by Guido van Rossum and first released in 1991. Its syntax is designed to be readable: blocks are defined by indentation instead of curly braces, and most statements read almost like plain English.
Python is used almost everywhere:
- Web backends with Django, Flask, or FastAPI.
- Data analysis and machine learning with pandas, NumPy, scikit-learn, and PyTorch.
- Automation and scripting: renaming files, processing CSVs, calling APIs.
- DevOps tooling, testing, and command-line applications.
Python is an interpreted language: you do not compile it manually before running it. The Python interpreter reads your code and executes it directly, which makes the edit-run cycle very fast for beginners.
Installing Python
Always install Python 3 (3.10 or newer is recommended for this series). Python 2 reached end of life in 2020 and should not be used for new projects.
- Windows: download the installer from python.org and tick "Add python.exe to PATH" before clicking Install.
- macOS: use the python.org installer or Homebrew (
brew install python). - Linux: most distributions ship Python 3; otherwise use your package manager, e.g.
sudo apt install python3.
Verify the installation in your terminal:
python3 --version
Output:
Python 3.12.6
On Windows the command is usually python or py instead of python3. Your exact version number may differ; anything from 3.10 upward is fine.
For an editor, VS Code with the official Python extension is a great free choice. PyCharm Community is another solid option.
The REPL: Python as a calculator
Type python3 with no arguments and you enter the REPL (Read-Eval-Print Loop). You type an expression, Python evaluates it, and prints the result immediately. The >>> symbol is the prompt.
>>> 2 + 3
5
>>> 10 / 4
2.5
>>> "Halo" + " Budi"
'Halo Budi'
>>> len("Python")
6
>>> exit()
Notice that in the REPL you do not need print(): the value of each expression is echoed automatically. Strings are echoed with quotes because the REPL shows their representation. Use exit() or press Ctrl+D (Ctrl+Z then Enter on Windows) to quit.
The REPL is perfect for quick experiments: checking how a function behaves, testing a small calculation, or exploring a new library with help() and dir().
Your first program with print()
Outside the REPL, you use the built-in print() function to show output. It accepts any number of values, separates them with a space, and ends with a newline.
print("Hello, World!")
print("Name:", "Budi", "Age:", 25)
print(7 * 6)
print() # prints an empty line
print("Done")
Output:
Hello, World!
Name: Budi Age: 25
42
Done
print() has two useful keyword arguments: sep changes the separator between values, and end changes what is printed at the end (a newline by default).
print("2026", "10", "13", sep="-")
print("Loading", end="...")
print("ok")
print("a", "b", "c", sep="")
Output:
2026-10-13
Loading...ok
abc
Comments start with #. Python ignores everything after # on that line, so use comments to explain why the code does something.
Running .py files
Real programs live in files with the .py extension. Create a folder for this series, then create a file named hello.py:
# hello.py
name = "Siti"
language = "Python"
print("Hello,", name)
print("Welcome to", language, "!")
print("1 + 2 =", 1 + 2)
Run it from the terminal, inside the folder that contains the file:
python3 hello.py
Output:
Hello, Siti
Welcome to Python !
1 + 2 = 3
Python executes the file from top to bottom, one statement at a time. If line 5 has an error, lines 1 to 4 have already run. You can also run files directly from VS Code using the "Run Python File" button in the top-right corner.
To read input from the user, use input(). It always returns a string:
# greet.py
name = input("What is your name? ")
print("Nice to meet you,", name)
If you type Budi and press Enter, the program prints Nice to meet you, Budi.
Common mistakes
- Wrong indentation. Python treats indentation as syntax. A stray space at the start of a line causes
IndentationError: unexpected indent. - Typing Python code in the terminal shell instead of the REPL, or vice versa.
python3 hello.pybelongs in the shell, not after>>>. - Mismatched quotes, such as
print("Hello'), cause aSyntaxError. Open and close a string with the same quote type. - Case sensitivity.
Print("hi")fails withNameErrorbecause the function isprint, all lowercase. - "python: command not found" usually means Python is not on your PATH. Reinstall with the PATH option, or try
python3/py.
Exercise
Create a file profile.py that prints a small profile card. Use sep and end at least once. One possible solution:
print("=" * 20)
print("Name", "Budi Santoso", sep=": ")
print("City", "Bandung", sep=": ")
print("Hobbies", end=": ")
print("coding", "reading", sep=", ")
print("=" * 20)
Output:
====================
Name: Budi Santoso
City: Bandung
Hobbies: coding, reading
====================
Notice the trick "=" * 20: multiplying a string by a number repeats it. We will explore operators like this in the next part.
Summary
- Python is a readable, interpreted, general-purpose language; always use Python 3.
- The REPL (
python3) is for quick experiments;.pyfiles are for real programs run withpython3 file.py. print()shows output and supportssepandend;input()reads text from the user.- Indentation and letter case matter in Python.
In Part 2 we will look at variables, data types, operators, and f-strings, the building blocks of every Python program.
Related articles
PostgreSQL Zero to Advanced #1: Introduction & Setup
Start the series by understanding what a relational database is, installing PostgreSQL locally, and getting comfortable with psql commands like \l, \c and \dt.
PHP Zero to Advanced #1: Introduction & Setup
Start your PHP journey: what PHP is, how to install PHP 8.2+, run the built-in development server, and write your very first script with echo.
Ruby on Rails Zero to Advanced #1: Ruby Basics
Start the Rails journey with the language underneath it: irb, variables, strings, puts vs p, and symbols explained with runnable examples.