18 min read
Setting Up Python
Install Python, use IDLE or VS Code, or code online — then create, save and run a .py file.
Three Ways to Write Python
| Where to write Python | ||
|---|---|---|
Installing Python
- Go to python.org/downloads and download the latest Python 3 release for your computer.
- Windows: run the installer and tick "Add python.exe to PATH" before clicking Install.
- Check it worked: open Command Prompt (or Terminal on a Mac) and type
python --version(on a Mac,python3 --version). You should see a version number such as Python 3.14.
Checking the installationCommand line
C:\Users\Dinesh> python --versionPython 3.14.0Using IDLE
- Open IDLE from the Start menu. The window that opens is the Shell: type a line like
2 + 3and press Enter to see the answer straight away. - For a full program, choose File → New File. Type your code.
- Save it with File → Save as bill.py — always use the .py extension.
- Run it with Run → Run Module (or press F5). The output appears in the Shell window.
Using VS Code
- Install the Python extension (by Microsoft) from the Extensions panel.
- File → Open Folder and choose a folder for your programs.
- Create a file ending in .py, type your code and save.
- Click the ▷ Run button at the top right. The output appears in the Terminal panel.
Practice
In IDLE, where can you type single lines of Python and see the result immediately?
More lessons in Python Programming · Next: Your First Program · Previous: Introduction
