Python First Steps

Welcome to your first steps with Python! This guide will help you set up your development environment and write your first Python program.

Installing Python

Windows

  1. Visit python.org
  2. Download the latest Python version
  3. Run the installer and check "Add Python to PATH"
  4. Click "Install Now"

macOS

  1. Install using Homebrew: brew install python
  2. Or download from python.org

Linux

Most Linux distributions come with Python pre-installed. To install the latest version:

bash
# Ubuntu/Debian
sudo apt update
sudo apt install python3 python3-pip

# CentOS/RHEL
sudo yum install python3 python3-pip

Verify Installation

Open your terminal or command prompt and run:

bash
python --version

Your First Python Program

Create a file called hello.py and add the following code:

python
print("Hello, World!")
print("Welcome to Python programming!")

Run your program:

bash
python hello.py

Python Interactive Shell

You can also run Python interactively by typing python in your terminal:

python
>>> print("Hello from Python!")
Hello from Python!
>>> 2 + 3
5
>>> exit()

Next Steps

Congratulations! You've successfully set up Python and run your first program. Next, learn about Variables and Data Types.