🐍 Introduction to Python

Getting Started with Python Programming

What is Python?

Python is a high-level, interpreted programming language known for its simplicity and readability. Created by Guido van Rossum in 1991, it's now one of the most popular programming languages worldwide.

🎯 Why Learn Python?

💻 Your First Python Program

# Hello World in Python
print("Hello, World!")

# Output: Hello, World!

📦 Installation

# Download from python.org
# Or use package managers:

# macOS (Homebrew)
brew install python3

# Linux (Ubuntu/Debian)
sudo apt update
sudo apt install python3 python3-pip

# Windows (Chocolatey)
choco install python

# Verify installation
python3 --version
# Output: Python 3.11.x

# Check pip (package manager)
pip3 --version

🚀 Running Python

# Interactive Mode (REPL)
python3
>>> print("Hello")
Hello
>>> 2 + 2
4
>>> exit()

# Run Python File
python3 script.py

# Python in VS Code
# 1. Install Python extension
# 2. Select interpreter (Cmd+Shift+P → Python: Select Interpreter)
# 3. Run with F5 or Run button

📝 Python Syntax Basics

# Comments start with #
# This is a comment

# Variables (no declaration needed)
name = "Alice"
age = 30
height = 5.6
is_student = True

# Print output
print(name)  # Alice
print(f"{name} is {age} years old")  # Alice is 30 years old

# Indentation matters (no braces)
if age >= 18:
    print("Adult")  # 4 spaces or 1 tab
    print("Can vote")

# Case sensitive
Name = "Bob"  # Different from 'name'

🎯 Key Takeaways