Installation and Setup
Before writing any code, we need to set up our tools.
1. Installing Python
We recommend installing the latest stable version of Python 3 (currently 3.10+).
- Windows/Mac: Download the installer directly from the official Python website (python.org). Crucial Step: During installation, ensure you check the box that says 'Add Python to PATH'.
- Linux: Python is often pre-installed, but you might need to install development tools or a newer version using your package manager (e.g.,
sudo apt install python3).
2. Choosing an Editor/IDE
An IDE (Integrated Development Environment) or a good code editor makes writing and debugging code much easier.
- VS Code (Recommended for Beginners): Free, powerful, and excellent Python integration.
- PyCharm Community Edition: A dedicated Python IDE, excellent for larger projects.
- Jupyter Notebooks (For Data Science): Useful for interactive, step-by-step code execution.
3. The First Test
Open your terminal or command prompt and type:
bash python --version
If Python is installed correctly and added to your PATH, you should see the version number (e.g., Python 3.11.4).