Computer Fundamentals & Python
Before you code, understand the machine. Discover how hardware components work together to run your programs, and explore Python's unique strengths with interactive visuals and live examples.
Core Components – Visual Overview
Click on the tabs below to explore each component's role in code execution.
🧠 brain cell The CPU fetches, decodes, and executes instructions – the heart of the machine.
ALU
Math & logic operations
Control Unit
Directs instruction flow
Registers
Ultra‑fast CPU memory
Cache
L1/L2/L3 – hot data nearby
RAM is the computer's short‑term workspace. Python variables live here while your program runs.
💡 RAM is ~100x faster than SSD and ~200x faster than HDD – that's why programs are loaded into RAM first!
🔺 The Memory Hierarchy Pyramid
Faster memory sits at the top, but is smaller and more expensive per byte. Slower memory sits at the bottom, but is cheap and vast.
✨ The CPU first looks in registers, then L1, L2, L3, then RAM, and finally disk – each step is dramatically slower.
Your .py files, Python interpreter, and libraries live on the disk permanently. They are copied to RAM when you run a program.
| HDD | SSD | |
|---|---|---|
| Speed | ~100 MB/s | ~500–7000 MB/s |
| Noise | Audible spinning | Silent |
| Durability | Fragile | Shock resistant |
The Operating System manages hardware and provides services to your Python code. It schedules processes, allocates memory, and handles files.
Process Mgmt
Memory Allocation
File System
I/O Handling
- GPU: Graphics & parallel processing (important for AI/ML)
- Motherboard: Connects all components
- Network Card: Enables internet and
pip install - BIOS/UEFI: Starts the computer and initializes hardware
🚀 Journey of a Python Program
Click each step to see what happens behind the scenes when you run hello.py.
Load from Disk
"Disk → RAM"
Parse & Check
"Syntax check"
Bytecode
"Compile to .pyc"
PVM Runs It
"Virtual machine"
CPU Crunches
"Machine code"
Output
"Result delivered"
🐍 Python – Why Developers Love It
📝 Interpreted
No compile step – run code instantly. Great for rapid prototyping.
🧩 Dynamic Typing
Variables don't need type declarations. Python figures out types at runtime.
📐 High‑Level
Focus on logic, not memory management. Automatic garbage collection.
📚 Rich Standard Library
Batteries included! Modules for JSON, CSV, email, web servers, and more.
🎯 Object‑Oriented
Everything is an object – even integers and functions can have attributes.
🌍 Cross‑Platform
Write once, run on Windows, macOS, Linux – no changes needed.
🔤 Indentation Matters
Clean, readable code enforced by whitespace – no curly braces!
🤝 Open Source
Free to use, modify, and distribute. Over 500,000 packages on PyPI.
⚖️ Python vs Other Languages
See how Python stacks up against popular languages in key areas. All bars animate as you scroll.
⚡ Execution Speed
Higher is better📚 Library / Ecosystem
Higher is better| Feature | Python 🐍 | Java ☕ | C++ ⚡ | JavaScript 🌐 |
|---|---|---|---|---|
| Typing | Dynamic | Static | Static | Dynamic |
| Best For | AI/ML, Data, Web | Enterprise, Android | Games, Systems | Web Fullstack |
| Learning Curve | Gentle | Moderate | Steep | Moderate |
Practice Problems (Solved)
1. Check Your Python Version & OS
import sys, platform
print(f"Python: {sys.version}")
print(f"OS: {platform.system()} {platform.release()}")2. Demonstrate Dynamic Typing
x = 42; print(type(x))
x = "hello"; print(type(x))3. List Files Using os Module
import os
for item in os.listdir('.'):
print(item)