ctrl + Q ACADEMY • ARCHITECTURE CORE

Data Systems & Object Routines: Python 3

Real syntax, real object model, and a real live interpreter running in your browser.

Tier 1: Foundations
Basics

Variables, Types & Indentation

Python has no braces — blocks are defined purely by indentation (4 spaces is convention). Core built-in types include int, float, str, bool, list, dict, tuple, and set.

basics.py
name = "Ada"
age = 29
is_active = True
scores = [90, 85, 78]

if age >= 18:
    print(f"{name} is an adult")
else:
    print(f"{name} is a minor")
Basics

Control Flow & Loops

for loops in Python iterate directly over items in a sequence — there's no manual index management needed. range(n) generates a sequence of numbers when you do need a counter.

loops.py
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
    print(fruit.upper())

for i in range(3):
    print(f"Iteration {i}")
Tier 2: Data Structures & Functions
Core

Lists, Dicts & Comprehensions

A list comprehension builds a new list in a single, readable expression instead of a multi-line loop. Dictionaries store key-value pairs and are the backbone of most Python data handling.

comprehensions.py
numbers = [1, 2, 3, 4, 5]
squares = [n * n for n in numbers]
evens = [n for n in numbers if n % 2 == 0]

user = {"name": "Priya", "age": 24}
user["role"] = "engineer"
Core

Functions & Default Arguments

Functions are defined with def. Parameters can have default values, and Python supports both positional and keyword arguments, which makes function calls self-documenting.

functions.py
def greet(name, greeting="Hello"):
    return f"{greeting}, {name}!"

print(greet("Sam"))
print(greet("Sam", greeting="Welcome"))
Tier 3: Object-Oriented Programming
Critical Spec

Classes, Objects & Inheritance

A class is a blueprint for objects. __init__ is the constructor, called automatically when an object is created. Subclasses inherit behavior from a parent class and can override methods to specialize it.

classes.py
class Animal:
    def __init__(self, name):
        self.name = name

    def speak(self):
        return f"{self.name} makes a sound"

class Dog(Animal):
    def speak(self):
        return f"{self.name} says Woof!"

print(Dog("Rex").speak())
Tier 4: Professional Practices
Professional

Error Handling & Context Managers

try/except catches exceptions so one failure doesn't crash the whole program. The with statement (a context manager) guarantees resources like files are closed automatically, even if an error occurs inside the block.

errors.py
try:
    result = 10 / 0
except ZeroDivisionError as e:
    print(f"Error: {e}")

with open("notes.txt", "w") as f:
    f.write("Saved safely, file closes automatically.")
Live Python Interpreter

Run Real Python — In Your Browser

This sandbox runs an actual CPython-compatible interpreter (Pyodide, compiled to WebAssembly) — not a simulation. Edit the code and click Run. The first run downloads the interpreter, so it may take a few seconds to initialize.

Interactive Python 3 Runtime

Click "Run Python Code" to initialize the live interpreter...
Tier 5: Real-World Practice
Applied

Working with JSON Data

JSON is the standard format for exchanging data between services. The built-in json module converts between JSON text and native Python objects: json.loads() parses a JSON string into a dict/list, and json.dumps() serializes Python objects back into JSON text.

json_demo.py
import json

raw = '{"name": "Priya", "skills": ["python", "sql"]}'
data = json.loads(raw)
print(data["skills"][0])  # "python"

data["active"] = True
print(json.dumps(data, indent=2))
Applied

Virtual Environments & pip

A virtual environment is an isolated Python installation for a single project, so its dependencies don't conflict with other projects. pip is the standard tool for installing packages from PyPI into that environment.

terminal
python3 -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install requests
pip freeze > requirements.txt
Quiz: In Python, what defines a block of code (like the body of a loop or function)?
Final Assessment

Ready to test what you've learned?

Take the Python certification exam — 8 questions, 70% to pass. Passing unlocks a downloadable certificate with your name on it.