Monday, March 9, 2026

PYTHON

 

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.

python
# This is Python - clean and readable
print("Hello, World!")  # Simple, right?

🎯 Why Learn Python?

ReasonExplanation
Readable SyntaxCode looks almost like natural English, making it easier to learn and maintain 
Versatile ApplicationsWeb development, data science, automation, AI/ML, and more 
Rich EcosystemExtensive standard library and thousands of third-party packages 
Cross-platformRuns on Windows, macOS, Linux, and many other platforms 
Strong CommunityExcellent documentation, tutorials, and community support 
Rapid DevelopmentFaster to write and maintain than many other languages 

🛠️ How to Set Up Python

Windows Installation

bash
# 1. Download from python.org
# 2. Run installer - IMPORTANT: Check "Add Python to PATH"
# 3. Verify installation
python --version

macOS Installation

bash
# Using Homebrew (recommended)
brew install python

# Verify
python3 --version

Linux Installation (Ubuntu/Debian)

bash
sudo apt update
sudo apt install python3 python3-pip python3-venv
python3 --version

📝 Your First Python Program

Create a file called hello.py:

python
#!/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:

bash
python3 hello.py