Installing Python
To start writing Python, you need to install the Python interpreter on your computer. The official Python installer is available from python.org and supports Windows, macOS, and Linux.
When installing on Windows, make sure to check the box that says 'Add Python to PATH' — this lets you run Python from the command line anywhere on your system.
- Visit https://python.org/downloads and download the latest Python 3.x release
- On Windows: Run the installer and check 'Add Python to PATH'
- On macOS: Use the official installer or install via Homebrew with 'brew install python3'
- On Linux: Python 3 is usually pre-installed. If not, use 'sudo apt install python3' (Ubuntu/Debian)
Example
# After installing, verify your installation
# Open a terminal or command prompt and type:
python --version
# Output: Python 3.x.x
# You can also check pip (Python's package manager)
pip --version Notes
- On some systems, you may need to use 'python3' and 'pip3' instead of 'python' and 'pip' to specifically invoke Python 3.
Choosing an IDE and Running Your First Script
An IDE (Integrated Development Environment) makes coding easier by providing features like syntax highlighting, auto-completion, debugging tools, and integrated terminals.
You can write Python in any text editor, but a good IDE greatly improves productivity. The two most popular choices for Python development are VS Code and PyCharm.
- VS Code: Free, lightweight, highly customizable with the Python extension by Microsoft
- PyCharm: Purpose-built for Python with powerful refactoring and debugging tools (Community edition is free)
- IDLE: Comes bundled with Python — simple but great for beginners
- Jupyter Notebook: Interactive environment popular in data science
Example
# Save this as hello.py and run it
# In terminal: python hello.py
print("Hello from my first Python script!")
print("Python is ready to go.")
# You can also run Python interactively
# Just type 'python' in your terminal to open the REPL
# >>> 2 + 2
# 4 Try Your First Script
JavaScript
# Save this as hello.py and run with: python hello.py
print("Hello from my first Python script!")
print("Python is ready to go.")
print("2 + 2 =", 2 + 2) Notes
- For this course, any text editor or IDE will work. We recommend VS Code with the Python extension for the best balance of simplicity and power.
