PART 1: PYTHON FUNDAMENTALS
1. INTRODUCTION TO PYTHON
📖 What is Python?
Python is a high-level, interpreted programming language created by Guido van Rossum and first released in 1991 . It is designed with a philosophy that emphasizes code readability through significant whitespace and a straightforward syntax that resembles natural English.
# This is Python - clean and readable print("Hello, World!") # Simple, right?
🎯 Why Learn Python?
🛠️ How to Set Up Python
Windows Installation
# 1. Download from python.org # 2. Run installer - IMPORTANT: Check "Add Python to PATH" # 3. Verify installation python --version
macOS Installation
# Using Homebrew (recommended) brew install python # Verify python3 --version
Linux Installation (Ubuntu/Debian)
sudo apt update sudo apt install python3 python3-pip python3-venv python3 --version
📝 Your First Python Program
Create a file called hello.py:
#!/usr/bin/env python3 """ My First Python Program This demonstrates basic Python syntax and structure """ # This is a comment - it's ignored by Python # Get user input name = input("What is your name? ") # Create a greeting greeting = f"Hello, {name}! Welcome to Python programming." # Display the greeting print(greeting) # Show current year year = 2026 print(f"The year is {year}")
Run it:
python3 hello.py