| layout | default |
|---|---|
| title | Setup |
| nav_order | 4 |
| permalink | /setup/ |
| course_lesson | true |
| course_index | 00 |
| next_page | /lessons/pythonic-python/ |
| next_title | Pythonic Python |
This page checks that Python works, creates a private project environment, and confirms that the Basic course knowledge is ready. Do not skip the readiness program: it tells you whether to continue or review first.
- A computer with Windows, macOS, or Linux
- Python 3.11 or newer
- A text editor that saves plain
.pyfiles - A terminal, which is the window where commands are typed
If this is a school or office computer, ask an adult or administrator before installing software.
Open PowerShell and run:
python --versionIf that command is unavailable, try:
py --versionIf neither works, follow the official Using Python on Windows instructions.
Open Terminal and run:
python3 --versionIf Python 3 is unavailable, use the installer from Python releases for macOS. Do not remove a Python installation supplied by the operating system.
Open a terminal and run:
python3 --versionPython is already installed on many Linux systems. If it is missing, use your distribution's package manager and the official Using Python on Unix guide.
The exact version number can be newer than the one named here. The important parts are Python 3 and a supported release.
On macOS or Linux:
mkdir python-intermediate-learning
cd python-intermediate-learningOn Windows PowerShell:
mkdir python-intermediate-learning
cd python-intermediate-learningmkdir creates a folder. cd moves the terminal into it.
A virtual environment is a private toolbox for one project. Packages installed for one project do not have to affect another project.
computer Python
├── course project .venv -> course packages
└── another project .venv -> different packages
python3 -m venv .venv
source .venv/bin/activate
python --versionpython -m venv .venv
.venv\Scripts\Activate.ps1
python --versionIf you use the py command, create it with py -m venv .venv.
When activation succeeds, the command line usually begins with (.venv). To leave the environment later, run deactivate.
If PowerShell blocks activation, do not weaken the whole computer's security settings. You can run the environment directly:
.venv\Scripts\python.exe program.pyMost lessons use Python's standard library and need no installation. The APIs lesson uses the third-party requests package. Install it inside the active environment when you reach that lesson:
python -m pip install requestsUsing python -m pip makes the selected Python interpreter run its own package installer.
Create readiness_check.py:
def passing_names(scores):
return [name for name, score in scores.items() if score >= 40]
student_scores = {"Asha": 82, "Ben": 35, "Chen": 67}
try:
result = passing_names(student_scores)
print(f"Passing students: {result}")
except TypeError as error:
print(f"Please check the data: {error}")Run it on macOS or Linux:
python readiness_check.pyRun it on Windows with python readiness_check.py or py readiness_check.py.
Expected output:
Passing students: ['Asha', 'Chen']
You are ready when you can explain these five facts:
passing_namesis a function.scoresis a parameter and receives a dictionary..items()gives each dictionary key and value.- The comprehension keeps scores of 40 or more.
tryandexceptprovide a plan for an error.
If two or more facts are unclear, review the matching Python Basic chapters before starting.
Try the operating-system command shown above. Close and reopen the terminal after installing Python. Confirm the installer completed successfully.
Use pwd on macOS/Linux or Get-Location on PowerShell to see the current folder. Use ls or dir to check that readiness_check.py is there.
Turn on filename extensions and rename the file so its final ending is .py.
Activate .venv, then run both installation and the program with the same python command. Check with:
python -m pip --version- A Python 3.11-or-newer version command works.
- The course folder exists.
-
.venvexists and can run Python. -
readiness_check.pyproduces the expected output. - I can explain the five Basic concepts used in the program.
- I know how to find the current folder and list its files.