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
- Visit python.org
- Download the latest Python version
- Run the installer and check "Add Python to PATH"
- Click "Install Now"
macOS
- Install using Homebrew:
brew install python - 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-pipVerify Installation
Open your terminal or command prompt and run:
bash
python --versionYour 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.pyPython 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.