LevelUpWith

Explore / Python from Zero: Useful Scripts for Work / Lesson 1

Lesson 1: Install Python and Run Your First Script

Install Python 3.13 or later and VS Code (or open a browser notebook), then write, save and run a one-line script and check that it worked.

Free to read, no account needed. Part of Python from Zero: Useful Scripts for Work.

By the end of this level you'll be able to

  • Install Python 3.13+ from python.org and confirm the version with `python --version` (or `py --version` on Windows)
  • Create a .py file in VS Code and run it from the editor and from the terminal
  • Tell apart a script that ran correctly from one that gave an error by reading the terminal output

Why start here

If you have written a spreadsheet formula, you have already programmed a little. You typed an instruction, pressed Enter, and the computer did it. Python works the same way, with two differences. The instructions live in a plain text file called a script, and a program called the Python interpreter reads that file from top to bottom and carries out each line.

By the end of this level you will have three things:

  1. Python 3.13 or later installed, with the version checked.
  2. VS Code set up as your editor.
  3. A one-line script that you have run twice, once from the editor and once from the terminal. You will also have broken it on purpose, so you can tell what an error looks like.

The current release is Python 3.15 (out 9 October 2026). Any version from 3.13 up is fine for this course, and the latest is the best choice.

Step 1: Install Python

Windows. Go to python.org/downloads and get the Python Install Manager, or install it from the Microsoft Store. It is now the recommended way to install Python on Windows. The old all-in-one installer has been deprecated since Python 3.14 and won't be made for 3.16 or later, so older tutorials may show screens you won't see. During setup you may be asked whether to add a folder to your PATH. Say yes, so the python command works from any terminal.

macOS. Download the .pkg installer from python.org/downloads/macos and run it. When it finishes, open /Applications/Python 3.15/ and double-click Install Certificates.command. Later scripts that call web APIs need it.

Now open a terminal (PowerShell on Windows, Terminal on macOS) and check what you installed:

# Windows
python --version
# Expected output, something like:
# Python 3.15.0

# Lists every Python version the Install Manager has installed
py list
# macOS: the command is python3, not python
python3 --version
# Python 3.15.0

Gotcha: If the version shown is lower than 3.13, an older Python on your machine is answering first. On macOS, always type python3. On Windows, run py list to see what is installed. Don't carry on until you see 3.13 or higher.

No install rights on a work laptop? A browser notebook such as Google Colab runs Python without installing anything. Be aware that Colab ran Python 3.12 through 2026, which is older than this course targets. That is fine for the early lessons, but a local install is better. To check the version, type !python --version in a cell.

Step 2: Install VS Code and the Python extension

Download VS Code from code.visualstudio.com and install it. Then:

  1. Open the Extensions panel (the icon made of four squares on the left).
  2. Search for Python and install the one published by Microsoft.
  3. Press Ctrl+Shift+P (Cmd+Shift+P on Mac), type Python: Select Interpreter, and choose the 3.13+ version you just installed.

The extension adds the Run button you'll use next. Selecting the interpreter tells VS Code which Python to run your code with. If you skip this, VS Code may quietly pick an old one.

Step 3: Write and save your first script

Make a folder for your work, for example Documents\python-work. In VS Code choose File > Open Folder and open it. Then create a new file named hello.py.

# hello.py: lines starting with # are comments; Python ignores them
print("Hello from Python!")   # print() shows text in the terminal

Save with Ctrl+S. The .py ending matters: it tells VS Code and Python that this is a Python script. A file called hello.txt with the same text would not run.

Step 4: Run it two ways

From the editor. Click the Run Python File play button (▷) at the top right. A terminal panel opens at the bottom and shows:

Hello from Python!

VS Code also prints the full command it ran just above your output. That's normal.

From the terminal. Open a terminal inside VS Code with Ctrl+Shift+` and type:

python hello.py      # Windows
# python3 hello.py   # macOS

You get the same output. It's worth knowing both ways. The button is convenient, but the terminal is how you'll run scripts on a schedule, on a server or when a colleague asks how.

Gotcha: python hello.py looks for the file in the terminal's current folder. If you get can't open file ... [Errno 2] No such file or directory, the terminal is in the wrong place. Change to your folder first with cd Documents\python-work.

Step 5: Break it on purpose

Professionals read errors every day, so it pays to learn now what one looks like. Change print to prin, save, and run again:

Traceback (most recent call last):
  File "C:\Users\you\Documents\python-work\hello.py", line 2, in <module>
    prin("Hello from Python!")
    ^^^^
NameError: name 'prin' is not defined. Did you mean: 'print'?

Here is how to read it:

  • Traceback at the top means the script stopped with an error.
  • The File ... line 2 line tells you which file and which line to look at.
  • The ^^^^ markers point at the part of the line Python is complaining about.
  • The last line names the problem. Recent versions often suggest a fix too (Did you mean: 'print'?).

A successful run shows only your output, with no Traceback and no line ending in Error. Fix the typo, save and run once more to get back to a clean result.

Best practice: Always save before you run. Running an unsaved file is one of the most common reasons a beginner thinks their fix "didn't work".

Your exercise

Add a second line to hello.py that prints your name, for example print("Report script by Sam"). Run it from the terminal.

Check: you should see two lines of output and no Traceback. If you see an error, read its last line, find the line number it gives, fix that line and run again.

Key takeaways

  • Check your version with python --version (Windows) or python3 --version (macOS). It must say 3.13 or higher.
  • On Windows, the Python Install Manager is now the recommended installer. The old installer is deprecated.
  • A script is a plain text file ending in .py. Save it before running.
  • Run a script with VS Code's Run Python File button, or with python hello.py in a terminal opened in the right folder.
  • No Traceback means success. If there is one, read the last line for the problem and the File ... line part for where it is.

A 6-question knowledge check follows this lesson in the app, free and without an account.

More like this

  • GitHub Copilot (GH-300) Exam Prep

    Learn GitHub Copilot hands-on in the editor, in the CLI and on github.com, and work through every skill in the GH-300 study guide (skills measured as of August…

    Exam prep · GH-300 · Software & Engineering · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 3, Mobile Apps, Games and Growth

    Turn your first live app into a real product. Learn to choose between web and app store apps, publish a browser game, take payments safely, run and monitor a l…

    Course · Software · Software & Engineering · Capable · 24 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 2, Online, Secure and AI-Powered

    Take one small app from your GitHub repository to a public web address. You will host it on Vercel and give it a Supabase database, sign-in and file storage, w…

    Course · Software · Software & Engineering · Capable · 16 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 1, From Prompt to Project

    Move an app you built in an AI chat onto your own computer and work on it step by step with a coding agent. Save your work with Git, keep secrets out of your c…

    Course · Software · Software & Engineering · Capable · 19 levels · 4 free · Professionally curated by levelupwith.com

  • Right Chip, Right Job: CPUs, GPUs, TPUs and Beyond

    Profile a workload, place it on a roofline and pick the processor that actually suits it, whether CPU, GPU, TPU, ASIC, inference chip, NPU, FPGA or DPU. You wi…

    Beyond the Obvious · Software & Engineering · Expert · 61 levels · 4 free · Professionally curated by levelupwith.com

  • Build Your First Website with HTML and CSS

    Start from a blank file and build a real, accessible personal or small-business website that works on phones. Each level adds to the same site, covering semant…

    Course · Software · Software & Engineering · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com