Recommended Prerequisites
Consider completing these modules before starting this one:
Understanding command line basics will help you run Python scripts and use pip for package management.
VS Code is a popular editor for Python development with excellent extensions for code completion and debugging.
🐍 Getting Started with Python
Python is a versatile programming language used in web development, data science, artificial intelligence, and more. This guide will help you install Python and verify your installation.
🔍 Installation Options
Choose the installation method that works best for your operating system:
📦 Method 1: Official Installer
- Visit the Python website: https://www.python.org/downloads/
- Download the latest version for your operating system
- Run the installer, following the on-screen instructions
- Make sure to check the box that says Add Python to PATH during installation
🍺 Method 2: Using Homebrew (Mac)
If you have Homebrew installed on your Mac, you can use it to install Python:
brew install python
✅ Verifying Installation
After installation, verify that Python is correctly installed by checking the version:
python --version
# or
python3 --version
💾 Installing pip
pip is the package installer for Python. If it's not already installed with your Python installation:
python -m ensurepip --default-pip
🚀 Getting Started
After installation, you can run Python in interactive mode:
Or execute a Python script:
python
# or
python3
python your_script.py
# or
python3 your_script.py
💻 Your First Python Program
Create a file named hello.py
with the following content:
Run the program with:
print("Hello, World!")
# Ask for user input
name = input("What is your name? ")
print(f"Hello, {name}!")
python hello.py
📚 Additional Resources
- Python Documentation: https://docs.python.org/
- Python Tutorial: https://docs.python.org/3/tutorial/
- Learn Python the Hard Way: https://learnpythonthehardway.org/
- Codecademy Python Course: https://www.codecademy.com/learn/learn-python-3