Python Get Started

Install Python and set up your development environment to start coding

šŸš€ Getting Started with Python

To start programming in Python, you need to install Python on your computer. Python is available for Windows, macOS, and Linux. Let's get you set up and ready to code!

Free
Installation
Cross
Platform
Easy
Setup

šŸŽÆ What You'll Learn

  • How to install Python on different operating systems
  • How to verify your Python installation
  • How to run your first Python program
  • Recommended code editors and IDEs
  • Setting up a virtual environment

Check if Python is Already Installed

Many computers come with Python pre-installed. Let's check if you already have Python on your system.

Windows Instructions:

  1. Press Win + R to open the Run dialog
  2. Type cmd and press Enter to open Command Prompt
  3. Type the following command and press Enter:
Command Prompt
python --version

Expected Output: If Python is installed, you'll see something like Python 3.11.0

If not installed: You'll see an error message like 'python' is not recognized as an internal or external command

macOS Instructions:

  1. Press Cmd + Space to open Spotlight
  2. Type Terminal and press Enter
  3. Type the following command and press Enter:
Terminal
python3 --version

Note: On macOS, use python3 instead of python to ensure you're using Python 3.x

Expected Output: Python 3.11.0 or similar

Linux Instructions:

  1. Open Terminal (usually Ctrl + Alt + T )
  2. Type the following command and press Enter:
Terminal
python3 --version

Note: Most Linux distributions come with Python pre-installed

Expected Output: Python 3.11.0 or similar

Download and Install Python

If Python is not installed on your system, follow these steps to install it:

1

Visit Python.org

Go to the official Python website: https://www.python.org/downloads/

The website automatically detects your operating system and shows the appropriate download button.

2

Download the Installer

Click the "Download Python" button to download the latest version for your operating system.

Recommended: Python 3.11 or later
3

Run the Installer

🪟

Windows

  • Run the downloaded .exe file
  • Important: Check "Add Python to PATH"
  • Click "Install Now"
šŸŽ

macOS

  • Run the downloaded .pkg file
  • Follow the installation wizard
  • Enter password when prompted
🐧

Linux

Ubuntu/Debian
sudo apt update
sudo apt install python3 python3-pip
4

Verify Installation

After installation, verify that Python is installed correctly:

Command Line
# Check Python version
python --version

# Check pip (package installer) version
pip --version
āœ… Success! If you see version numbers, Python is installed correctly.

Your First Python Program

Now that Python is installed, let's write and run your first Python program!

šŸ’»

Method 1: Interactive Shell

The Python interactive shell (REPL) allows you to run Python code line by line.

Step 1: Open your command line/terminal
Step 2: Type python and press Enter
Step 3: You'll see the Python prompt >>>
Python Interactive Shell
>>> print("Hello, World!")
Hello, World!
>>> print("Welcome to Python!")
Welcome to Python!
>>> 2 + 3
5
>>> name = "Alice"
>>> print(f"Hello, {name}!")
Hello, Alice!
>>> exit()  # To quit
šŸ“„

Method 2: Python File

For longer programs, create a Python file (.py extension).

hello.py
# My first Python program
print("Hello, World!")
print("This is my first Python program!")

# Variables and basic operations
name = "Python Learner"
age = 25
favorite_number = 7

print(f"My name is {name}")
print(f"I am {age} years old")
print(f"My favorite number is {favorite_number}")

# Simple calculation
result = favorite_number * 2
print(f"{favorite_number} multiplied by 2 equals {result}")

# Fun fact
print("Did you know? Python was named after Monty Python's Flying Circus!")
Run the program
python hello.py

Recommended Code Editors and IDEs

While you can write Python code in any text editor, using a proper code editor or IDE will make your coding experience much better.

šŸ†š

Visual Studio Code

⭐⭐⭐⭐⭐

Best for: Beginners and professionals

  • Free and open-source
  • Excellent Python extension
  • Built-in terminal
  • Git integration
šŸ

PyCharm

⭐⭐⭐⭐⭐

Best for: Professional development

  • Powerful Python IDE
  • Advanced debugging
  • Code refactoring tools
  • Free Community Edition
šŸ““

Jupyter Notebook

⭐⭐⭐⭐

Best for: Data science and learning

  • Interactive coding environment
  • Great for data analysis
  • Supports visualizations
  • Web-based interface
⚔

Sublime Text

⭐⭐⭐⭐

Best for: Fast and lightweight editing

  • Very fast and responsive
  • Multiple cursors
  • Powerful search and replace
  • Cross-platform

šŸ‹ļø Practice Exercise: Test Your Setup

Try creating and running this simple program to test your setup:

test_setup.py
import sys
import datetime

print("šŸ Python Setup Test")
print("=" * 30)
print(f"Python version: {sys.version}")
print(f"Current date: {datetime.date.today()}")
print(f"Platform: {sys.platform}")

# Test basic operations
numbers = [1, 2, 3, 4, 5]
total = sum(numbers)
print(f"Sum of {numbers} = {total}")

# Test string operations
name = input("What's your name? ")
print(f"Hello, {name}! Welcome to Python programming!")

print("\nāœ… If you can see this message, your Python setup is working correctly!")

šŸŽ‰ Congratulations! You're Ready to Code

You now have Python installed and ready to use. Here's what you should do next:

šŸ“–

Learn Python Syntax

Understand the basic rules and structure of Python code

šŸ’»

Practice Coding

Start with simple programs and gradually build complexity

šŸ› ļø

Set Up Your IDE

Configure your development environment for better productivity