NEW

How it works — a visual guide

Short animated videos that explain the hardest moments in programming. Each video covers exactly one idea: the code runs line by line while memory, the call stack, and the console change right in front of you. Covering JavaScript, Python, and PHP.

  • 616interactive learning items
  • 560animated videos
  • 56trainers
  • 3programming languages
  • 15topic sections

Showing: 560 videos

Basics

216
JS#01BasicsWhat is a variable and how does it change?Creating a memory "box" with let and const, and updating its value.JavaScript · 4 · ~13s JS#02BasicsData types and typeofnumber, string, boolean, null — and the famous typeof null surprise.JavaScript · 8 · ~18s JS#03BasicsArithmetic operators: + − * / %How addition, subtraction, multiplication, division, and remainder (%) are computed.JavaScript · 6 · ~13s JS#05BasicsThe difference between == and ===Why is 5 == "5" true, but 5 === "5" is not?JavaScript · 4 · ~11s JS#06BasicsScopeWhy doesn't a variable inside a function affect the one outside?JavaScript · 7 · ~18s JS#44BasicsAnimated: What JavaScript Is and Where It RunsWhat JavaScript Is and Where It Runs: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#46BasicsAnimated: DevTools and the Console: console.log, table, group…DevTools and the Console: console.log, table, group, time: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#47BasicsAnimated: Dev Environment: VS Code, Node.js 22 and Running Scr…Dev Environment: VS Code, Node.js 22 and Running Scripts: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#48BasicsAnimated: Syntax: Statements, Semicolons, Comments and Strict…Syntax: Statements, Semicolons, Comments and Strict Mode: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#49BasicsAnimated: Simple User Dialogs: alert, prompt and confirmSimple User Dialogs: alert, prompt and confirm: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#50BasicsAnimated: Numbers and Arithmetic OperatorsNumbers and Arithmetic Operators: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#51BasicsAnimated: Booleans: true, false, Truthy and Falsy ValuesBooleans: true, false, Truthy and Falsy Values: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#52BasicsAnimated: null vs undefined: What's the Differencenull vs undefined: What's the Difference: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#53BasicsAnimated: Type Conversion: Explicit and Implicit CoercionType Conversion: Explicit and Implicit Coercion: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#54BasicsAnimated: Default Parameters and Rest ParametersDefault Parameters and Rest Parameters: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#56BasicsAnimated: Hoisting, var and the Temporal Dead ZoneHoisting, var and the Temporal Dead Zone: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#57BasicsAnimated: Closures: How Functions Remember Their ScopeClosures: How Functions Remember Their Scope: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#59BasicsAnimated: Optional Chaining ?.: Safe Property AccessOptional Chaining ?.: Safe Property Access: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#61BasicsAnimated: Regular Expressions: Syntax, Flags and Character Cla…Regular Expressions: Syntax, Flags and Character Classes: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#64BasicsAnimated: Working with Numbers: Math, Rounding, parseInt and B…Working with Numbers: Math, Rounding, parseInt and BigInt: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#65BasicsAnimated: The Date Object: Creating Dates and Reading ComponentsThe Date Object: Creating Dates and Reading Components: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~10s JS#66BasicsAnimated: Date Arithmetic and Time ZonesDate Arithmetic and Time Zones: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~10s JS#67BasicsAnimated: Intl.DateTimeFormat and RelativeTimeFormat: Formatti…Intl.DateTimeFormat and RelativeTimeFormat: Formatting Dates: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~10s JS#68BasicsAnimated: Intl.NumberFormat, PluralRules and ListFormatIntl.NumberFormat, PluralRules and ListFormat: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#70BasicsAnimated: WeakMap, WeakSet and Garbage CollectionWeakMap, WeakSet and Garbage Collection: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#71BasicsAnimated: JSON: JSON.stringify and JSON.parseJSON: JSON.stringify and JSON.parse: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#72BasicsAnimated: Symbol: Unique Keys and Well-Known SymbolsSymbol: Unique Keys and Well-Known Symbols: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#74BasicsAnimated: Generators: function* and yieldGenerators: function* and yield: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#75BasicsAnimated: this: How the Context Is Determinedthis: How the Context Is Determined: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#76BasicsAnimated: call, apply and bind: Controlling the Contextcall, apply and bind: Controlling the Context: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#78BasicsAnimated: Prototypes and the Prototype ChainPrototypes and the Prototype Chain: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#79BasicsAnimated: Classes: constructor, Methods and FieldsClasses: constructor, Methods and Fields: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#80BasicsAnimated: Getters and SettersGetters and Setters: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#81BasicsAnimated: Static Properties and MethodsStatic Properties and Methods: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#84BasicsAnimated: Debugging in DevTools: Breakpoints and debuggerDebugging in DevTools: Breakpoints and debugger: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#103BasicsAnimated: Built-in Validation: the Constraint Validation APIBuilt-in Validation: the Constraint Validation API: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~15s JS#105BasicsAnimated: localStorage and sessionStorage: Storing Data in the…localStorage and sessionStorage: Storing Data in the Browser: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#106BasicsAnimated: Timers: setTimeout and setIntervalTimers: setTimeout and setInterval: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#107BasicsAnimated: Microtasks and Macrotasks: Execution OrderMicrotasks and Macrotasks: Execution Order: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#111BasicsAnimated: HTTP and REST for Frontend: Methods, Status Codes, H…HTTP and REST for Frontend: Methods, Status Codes, Headers: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#115BasicsAnimated: Loading States in the UI and Request Race ConditionsLoading States in the UI and Request Race Conditions: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#116BasicsAnimated: API Authentication: Keys, Tokens and CORSAPI Authentication: Keys, Tokens and CORS: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#117BasicsAnimated: The BOM: window, location, navigator and screenThe BOM: window, location, navigator and screen: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#118BasicsAnimated: History API: pushState, popstate and Simple RoutingHistory API: pushState, popstate and Simple Routing: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#119BasicsAnimated: IntersectionObserver: Lazy Loading and Infinite ScrollIntersectionObserver: Lazy Loading and Infinite Scroll: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#120BasicsAnimated: Geolocation and Clipboard APIs: Working with Permiss…Geolocation and Clipboard APIs: Working with Permissions: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#121BasicsAnimated: IndexedDB: An Introduction to the Browser DatabaseIndexedDB: An Introduction to the Browser Database: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#122BasicsAnimated: Web Workers: Running Heavy Work in the BackgroundWeb Workers: Running Heavy Work in the Background: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#123BasicsAnimated: Canvas: An Introduction to DrawingCanvas: An Introduction to Drawing: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#124BasicsAnimated: Drag and Drop API: Dragging ElementsDrag and Drop API: Dragging Elements: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#125BasicsAnimated: ES Modules: import and exportES Modules: import and export: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#126BasicsAnimated: Dynamic import(), Top-Level await and import.metaDynamic import(), Top-Level await and import.meta: follow a runnable example step by step and see how its data and result change.JavaScript · 2 · ~7s JS#127BasicsAnimated: npm: package.json, Dependencies and Scriptsnpm: package.json, Dependencies and Scripts: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#128BasicsAnimated: Vite: Project Setup, Dev Server and BuildVite: Project Setup, Dev Server and Build: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#129BasicsAnimated: Code Style: ESLint and PrettierCode Style: ESLint and Prettier: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#130BasicsAnimated: Unit Testing with VitestUnit Testing with Vitest: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#131BasicsAnimated: jQuery: A Quick Overview for Reading Legacy CodejQuery: A Quick Overview for Reading Legacy Code: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#133BasicsAnimated: Currying, Partial Application and Function CompositionCurrying, Partial Application and Function Composition: follow a runnable example step by step and see how its data and result change.JavaScript · 6 · ~23s JS#134BasicsAnimated: Debounce and Throttle: Controlling Call FrequencyDebounce and Throttle: Controlling Call Frequency: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#135BasicsAnimated: Frontend Security: XSS, innerHTML vs textContentFrontend Security: XSS, innerHTML vs textContent: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#136BasicsAnimated: Performance: Reflow, requestAnimationFrame and Memor…Performance: Reflow, requestAnimationFrame and Memory Leaks: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#139BasicsAnimated: Adding Expiration to Web Storage DataAdding Expiration to Web Storage Data: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s JS#141BasicsAnimated: Reading Query Parameters from a URLReading Query Parameters from a URL: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#142BasicsAnimated: Loading a Module DynamicallyLoading a Module Dynamically: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~18s PY#01BasicsWhat is a variable and how does it change?Creating a variable in Python without a keyword, and updating its value.Python · 4 · ~11s PY#02BasicsData types and type()int, float, str, bool — every value has its own type.Python · 8 · ~17s PY#03BasicsOperators: / // % **Regular division, integer division, remainder, and exponentiation.Python · 5 · ~10s PY#05BasicsLocal and global variablesWhy doesn't the x inside a function touch the x outside it?Python · 7 · ~19s PY#06BasicsSwapping two variablesa, b = b, a — no helper variable needed, using a tuple.Python · 4 · ~10s PY#36BasicsAnimated: What Python Is and Where It Is UsedWhat Python Is and Where It Is Used: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#37BasicsAnimated: Installing Python and First Terminal CommandsInstalling Python and First Terminal Commands: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#38BasicsAnimated: The REPL and Your First Script: Running Python CodeThe REPL and Your First Script: Running Python Code: follow a runnable example step by step and see how its data and result change.Python · 5 · ~21s PY#39BasicsAnimated: Setting Up VS Code for Python: Extensions, Interpret…Setting Up VS Code for Python: Extensions, Interpreter, Debugging: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#40BasicsAnimated: print(), Comments and Syntax Basicsprint(), Comments and Syntax Basics: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#42BasicsAnimated: Virtual Environments with venv and Installing Your F…Virtual Environments with venv and Installing Your First Package: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#44BasicsAnimated: int and float: Arithmetic and Operator Precedenceint and float: Arithmetic and Operator Precedence: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#45BasicsAnimated: Built-in Numeric Functions and the math ModuleBuilt-in Numeric Functions and the math Module: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#46BasicsAnimated: Decimal and Fraction: Exact Money and Fraction Arith…Decimal and Fraction: Exact Money and Fraction Arithmetic: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#47BasicsAnimated: input() and Type Conversioninput() and Type Conversion: follow a runnable example step by step and see how its data and result change.Python · 4 · ~14s PY#48BasicsAnimated: The bool Type and Comparison OperatorsThe bool Type and Comparison Operators: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#53BasicsAnimated: Nested LoopsNested Loops: follow a runnable example step by step and see how its data and result change.Python · 5 · ~17s PY#58BasicsAnimated: Nested Structures: Lists of Dicts and Dicts of ListsNested Structures: Lists of Dicts and Dicts of Lists: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#63BasicsAnimated: *args, **kwargs and Argument Unpacking*args, **kwargs and Argument Unpacking: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#64BasicsAnimated: Type Annotations and Docstrings in FunctionsType Annotations and Docstrings in Functions: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#67BasicsAnimated: ClosuresClosures: follow a runnable example step by step and see how its data and result change.Python · 5 · ~17s PY#70BasicsAnimated: Iterables and Iterators: iter() and next()Iterables and Iterators: iter() and next(): follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#71BasicsAnimated: Generator Functions and yieldGenerator Functions and yield: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#72BasicsAnimated: yield from and Generator Pipelinesyield from and Generator Pipelines: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#75BasicsAnimated: Reading Files: open(), Modes, Encodings and withReading Files: open(), Modes, Encodings and with: follow a runnable example step by step and see how its data and result change.Python · 7 · ~29s PY#76BasicsAnimated: Writing Files: w, a, x Modes and Binary FilesWriting Files: w, a, x Modes and Binary Files: follow a runnable example step by step and see how its data and result change.Python · 7 · ~28s PY#77BasicsAnimated: pathlib: Working with Pathspathlib: Working with Paths: follow a runnable example step by step and see how its data and result change.Python · 7 · ~26s PY#78BasicsAnimated: os and shutil: Copying, Moving and Deleting Filesos and shutil: Copying, Moving and Deleting Files: follow a runnable example step by step and see how its data and result change.Python · 7 · ~29s PY#79BasicsAnimated: JSON: Saving and Loading DataJSON: Saving and Loading Data: follow a runnable example step by step and see how its data and result change.Python · 6 · ~21s PY#80BasicsAnimated: CSV: Reading and Writing TablesCSV: Reading and Writing Tables: follow a runnable example step by step and see how its data and result change.Python · 7 · ~27s PY#81BasicsAnimated: Importing Modules: import, from, as and sys.pathImporting Modules: import, from, as and sys.path: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#82BasicsAnimated: Your Own Modules and if __name__ == '__main__'Your Own Modules and if __name__ == '__main__': follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#83BasicsAnimated: Packages and Project StructurePackages and Project Structure: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#84BasicsAnimated: pip and Dependencies: PyPI, Versions, requirements.txtpip and Dependencies: PyPI, Versions, requirements.txt: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#85BasicsAnimated: uv: A Modern Project and Package Manageruv: A Modern Project and Package Manager: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#86BasicsAnimated: pyproject.toml and Building Your Own Packagepyproject.toml and Building Your Own Package: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#87BasicsAnimated: datetime: Dates, Times and Intervalsdatetime: Dates, Times and Intervals: follow a runnable example step by step and see how its data and result change.Python · 4 · ~13s PY#88BasicsAnimated: Date Formatting and Time Zones (zoneinfo)Date Formatting and Time Zones (zoneinfo): follow a runnable example step by step and see how its data and result change.Python · 4 · ~14s PY#90BasicsAnimated: itertools: Efficient Iteratorsitertools: Efficient Iterators: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#91BasicsAnimated: functools: partial, cache, lru_cache and singledispatchfunctools: partial, cache, lru_cache and singledispatch: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#92BasicsAnimated: random and secrets: Random Numbers and Secure Tokensrandom and secrets: Random Numbers and Secure Tokens: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#93BasicsAnimated: Regular Expressions: re Module BasicsRegular Expressions: re Module Basics: follow a runnable example step by step and see how its data and result change.Python · 4 · ~15s PY#95BasicsAnimated: logging: Logging Instead of printlogging: Logging Instead of print: follow a runnable example step by step and see how its data and result change.Python · 8 · ~29s PY#96BasicsAnimated: argparse: Command-Line Tools with Argumentsargparse: Command-Line Tools with Arguments: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#98BasicsAnimated: The __init__ Constructor, self and Instance AttributesThe __init__ Constructor, self and Instance Attributes: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#100BasicsAnimated: @classmethod and @staticmethod@classmethod and @staticmethod: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#101BasicsAnimated: Encapsulation and @propertyEncapsulation and @property: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#102BasicsAnimated: Magic Methods __str__ and __repr__Magic Methods __str__ and __repr__: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#103BasicsAnimated: Comparing and Hashing Objects: __eq__, __lt__, __hash__Comparing and Hashing Objects: __eq__, __lt__, __hash__: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#104BasicsAnimated: dataclasses: Data Classes Without Boilerplatedataclasses: Data Classes Without Boilerplate: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#105BasicsAnimated: dataclasses: field, frozen, slots, __post_init__ and…dataclasses: field, frozen, slots, __post_init__ and match/case: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#106BasicsAnimated: Abstract Base Classes: the abc ModuleAbstract Base Classes: the abc Module: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#107BasicsAnimated: Enumerations: Enum, StrEnum and IntEnumEnumerations: Enum, StrEnum and IntEnum: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#108BasicsAnimated: Custom Context ManagersCustom Context Managers: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#109BasicsAnimated: Type Hints in Depth: Literal, TypedDict, Callable, A…Type Hints in Depth: Literal, TypedDict, Callable, Aliases: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#110BasicsAnimated: Generics and ProtocolsGenerics and Protocols: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#111BasicsAnimated: mypy: Static Type Checkingmypy: Static Type Checking: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#112BasicsAnimated: PEP 8 and Ruff: Code Style, Linting and FormattingPEP 8 and Ruff: Code Style, Linting and Formatting: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#113BasicsAnimated: pytest: Writing Your First Testspytest: Writing Your First Tests: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#114BasicsAnimated: pytest: Fixtures and conftest.pypytest: Fixtures and conftest.py: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#115BasicsAnimated: pytest: Parametrization, Markers and Coveragepytest: Parametrization, Markers and Coverage: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#116BasicsAnimated: Mocking: unittest.mock and monkeypatchMocking: unittest.mock and monkeypatch: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#117BasicsAnimated: How HTTP and REST APIs WorkHow HTTP and REST APIs Work: follow a runnable example step by step and see how its data and result change.Python · 6 · ~20s PY#118BasicsAnimated: requests: GET Requests and Working with JSONrequests: GET Requests and Working with JSON: follow a runnable example step by step and see how its data and result change.Python · 6 · ~21s PY#119BasicsAnimated: requests: POST, Headers, Authentication and Sessionsrequests: POST, Headers, Authentication and Sessions: follow a runnable example step by step and see how its data and result change.Python · 6 · ~21s PY#121BasicsAnimated: httpx: A Modern HTTP Clienthttpx: A Modern HTTP Client: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#122BasicsAnimated: Web Scraping: HTML and BeautifulSoupWeb Scraping: HTML and BeautifulSoup: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#123BasicsAnimated: Scraping in Practice: Pagination, Delays and EthicsScraping in Practice: Pagination, Delays and Ethics: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#124BasicsAnimated: SQLite and the sqlite3 Module: First QueriesSQLite and the sqlite3 Module: First Queries: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#125BasicsAnimated: sqlite3: Query Parameters, CRUD and Transactionssqlite3: Query Parameters, CRUD and Transactions: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#126BasicsAnimated: SQLAlchemy 2.0: Introduction to ORMSQLAlchemy 2.0: Introduction to ORM: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#127BasicsAnimated: FastAPI: Your First REST APIFastAPI: Your First REST API: follow a runnable example step by step and see how its data and result change.Python · 6 · ~20s PY#129BasicsAnimated: Threads: threading and ThreadPoolExecutorThreads: threading and ThreadPoolExecutor: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#130BasicsAnimated: Processes: multiprocessing and ProcessPoolExecutorProcesses: multiprocessing and ProcessPoolExecutor: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#131BasicsAnimated: asyncio: async/await and the Event Loopasyncio: async/await and the Event Loop: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#132BasicsAnimated: asyncio: Tasks, TaskGroup, Timeouts and Cancellationasyncio: Tasks, TaskGroup, Timeouts and Cancellation: follow a runnable example step by step and see how its data and result change.Python · 8 · ~28s PY#134BasicsAnimated: Telegram Bots with aiogram: Commands and HandlersTelegram Bots with aiogram: Commands and Handlers: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#135BasicsAnimated: Telegram Bots: Keyboards, Callback Buttons and State…Telegram Bots: Keyboards, Callback Buttons and States (FSM): follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PHP#01BasicsVariables and the $ signCreating variables in PHP and using them inside double-quoted strings.PHP · 4 · ~11s PHP#23BasicsAnimated: How the Web Works: Client, Server, HTTP Request and…How the Web Works: Client, Server, HTTP Request and Response: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#24BasicsAnimated: What Is PHP: Interpreter, Web Server and PHP-FPMWhat Is PHP: Interpreter, Web Server and PHP-FPM: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#25BasicsAnimated: Installing PHP: XAMPP, Laragon, Docker and the Built…Installing PHP: XAMPP, Laragon, Docker and the Built-in Server: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#26BasicsAnimated: First Script: <?php Tags, echo, Comments and PHP Ins…First Script: <?php Tags, echo, Comments and PHP Inside HTML: follow a runnable example step by step and see how its data and result change.PHP · 4 · ~17s PHP#28BasicsAnimated: Data Types: int, float, string, bool, null and Type…Data Types: int, float, string, bool, null and Type Checking: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#29BasicsAnimated: Explicit Type Casting: (int), intval() and settype()Explicit Type Casting: (int), intval() and settype(): follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#30BasicsAnimated: Type Juggling and Comparisons: == vs ===Type Juggling and Comparisons: == vs ===: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#31BasicsAnimated: Arithmetic and Assignment OperatorsArithmetic and Assignment Operators: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#32BasicsAnimated: Comparison, Logical and Spaceship OperatorsComparison, Logical and Spaceship Operators: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#33BasicsAnimated: Console Input: readline(), STDIN and $argvConsole Input: readline(), STDIN and $argv: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#34BasicsAnimated: The switch Statement: case, break, default and Its P…The switch Statement: case, break, default and Its Pitfalls: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#35BasicsAnimated: The for Loop, Nested Loops, break and continueThe for Loop, Nested Loops, break and continue: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#40BasicsAnimated: Numbers and Math: Float Precision, Rounding and rand…Numbers and Math: Float Precision, Rounding and random_int: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#43BasicsAnimated: Strict Mode declare(strict_types=1) and TypeErrorStrict Mode declare(strict_types=1) and TypeError: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#44BasicsAnimated: Scope, Static Variables and Passing by ReferenceScope, Static Variables and Passing by Reference: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#47BasicsAnimated: Custom Sorting: usort, uasort, uksort and <=>Custom Sorting: usort, uasort, uksort and <=>: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~16s PHP#48BasicsAnimated: Including Files: include, require, *_once and Code O…Including Files: include, require, *_once and Code Organization: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#49BasicsAnimated: Date and Time: Timestamps, date() and DateTimeImmutableDate and Time: Timestamps, date() and DateTimeImmutable: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~10s PHP#50BasicsAnimated: Intervals and Time Zones: DateInterval, DatePeriod a…Intervals and Time Zones: DateInterval, DatePeriod and Asia/Baku: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~10s PHP#51BasicsAnimated: Regular Expressions: Pattern Syntax and preg_matchRegular Expressions: Pattern Syntax and preg_match: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#53BasicsAnimated: JSON in PHP: json_encode, json_decode and Error Hand…JSON in PHP: json_encode, json_decode and Error Handling: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~15s PHP#54BasicsAnimated: Superglobals and GET Requests: $_SERVER, $_GET and U…Superglobals and GET Requests: $_SERVER, $_GET and URL Parameters: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#58BasicsAnimated: HTTP Headers, Status Codes and RedirectsHTTP Headers, Status Codes and Redirects: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#59BasicsAnimated: File Uploads: $_FILES, move_uploaded_file and LimitsFile Uploads: $_FILES, move_uploaded_file and Limits: follow a runnable example step by step and see how its data and result change.PHP · 7 · ~27s PHP#60BasicsAnimated: Reading and Writing Files: file_get_contents, file_p…Reading and Writing Files: file_get_contents, file_put_contents and file(): follow a runnable example step by step and see how its data and result change.PHP · 7 · ~27s PHP#61BasicsAnimated: File Streams: fopen, fgets, fwrite and flockFile Streams: fopen, fgets, fwrite and flock: follow a runnable example step by step and see how its data and result change.PHP · 7 · ~27s PHP#62BasicsAnimated: Working with CSV: fgetcsv, fputcsv, Importing and Ex…Working with CSV: fgetcsv, fputcsv, Importing and Exporting Data: follow a runnable example step by step and see how its data and result change.PHP · 7 · ~27s PHP#63BasicsAnimated: Directories and the File System: scandir, glob, mkdi…Directories and the File System: scandir, glob, mkdir and Safe Paths: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#64BasicsAnimated: Cookies: setcookie, Lifetime and Security OptionsCookies: setcookie, Lifetime and Security Options: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#65BasicsAnimated: Sessions: session_start, $_SESSION and Flash MessagesSessions: session_start, $_SESSION and Flash Messages: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#73BasicsAnimated: Enums: Pure and Backed Enums, Methods and matchEnums: Pure and Backed Enums, Methods and match: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#74BasicsAnimated: readonly Properties and Classes: Immutable Value Obj…readonly Properties and Classes: Immutable Value Objects: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#77BasicsAnimated: Late Static Binding: static:: vs self::Late Static Binding: static:: vs self::: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#79BasicsAnimated: Attributes and the Reflection APIAttributes and the Reflection API: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#83BasicsAnimated: Namespaces: namespace, use and AliasesNamespaces: namespace, use and Aliases: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#84BasicsAnimated: Class Autoloading: spl_autoload_register and PSR-4Class Autoloading: spl_autoload_register and PSR-4: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#85BasicsAnimated: Composer: composer.json, require, vendor and Autoloa…Composer: composer.json, require, vendor and Autoloading: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#86BasicsAnimated: Package Versions: SemVer, composer.lock, install and…Package Versions: SemVer, composer.lock, install and update: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#87BasicsAnimated: PSR Standards and Code Quality: PER Coding Style, PH…PSR Standards and Code Quality: PER Coding Style, PHP-CS-Fixer, PHPStan: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#88BasicsAnimated: App Configuration: .env, phpdotenv and SecretsApp Configuration: .env, phpdotenv and Secrets: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#89BasicsAnimated: Logging with Monolog: Channels, Handlers and PSR-3 L…Logging with Monolog: Channels, Handlers and PSR-3 Levels: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~21s PHP#90BasicsAnimated: Sending Emails: PHPMailer, SMTP and HTML EmailsSending Emails: PHPMailer, SMTP and HTML Emails: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#91BasicsAnimated: MySQL for PHP Developers: Tables, Types and CRUD Que…MySQL for PHP Developers: Tables, Types and CRUD Queries: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#92BasicsAnimated: Table Relationships: Foreign Keys, JOIN and IndexesTable Relationships: Foreign Keys, JOIN and Indexes: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#93BasicsAnimated: Connecting with PDO: DSN, Options and Error HandlingConnecting with PDO: DSN, Options and Error Handling: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#94BasicsAnimated: Prepared Statements: prepare, execute, Placeholders…Prepared Statements: prepare, execute, Placeholders and SQL Injection: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#96BasicsAnimated: CRUD with PDO: Create, Read, Update, Delete and Pagi…CRUD with PDO: Create, Read, Update, Delete and Pagination: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#97BasicsAnimated: Transactions: beginTransaction, commit, rollBack and…Transactions: beginTransaction, commit, rollBack and Locking: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#98BasicsAnimated: XSS: Cross-Site Scripting and Context-Aware EscapingXSS: Cross-Site Scripting and Context-Aware Escaping: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#99BasicsAnimated: CSRF: Cross-Site Request Forgery and TokensCSRF: Cross-Site Request Forgery and Tokens: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#100BasicsAnimated: SQL and Other Injections: Allowlists, OS Commands an…SQL and Other Injections: Allowlists, OS Commands and Path Traversal: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#101BasicsAnimated: Storing Passwords: password_hash, password_verify an…Storing Passwords: password_hash, password_verify and Rehashing: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#102BasicsAnimated: Session and Login Security: Fixation, Hijacking and…Session and Login Security: Fixation, Hijacking and Brute Force: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#103BasicsAnimated: Secure File Uploads: MIME Types, Extensions and Stor…Secure File Uploads: MIME Types, Extensions and Storage Outside Web Root: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#104BasicsAnimated: Security Headers, HTTPS and the OWASP Top 10 ChecklistSecurity Headers, HTTPS and the OWASP Top 10 Checklist: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#105BasicsAnimated: REST Principles: Resources, HTTP Methods and Status…REST Principles: Resources, HTTP Methods and Status Codes: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#106BasicsAnimated: A JSON API in Plain PHP: Request Body, Responses and…A JSON API in Plain PHP: Request Body, Responses and CORS: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#107BasicsAnimated: API Routing: Front Controller, Methods and Path Para…API Routing: Front Controller, Methods and Path Parameters: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#108BasicsAnimated: API Validation and Authentication: Tokens, JWT and R…API Validation and Authentication: Tokens, JWT and Rate Limiting: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~15s PHP#109BasicsAnimated: cURL: Calling External APIs from PHPcURL: Calling External APIs from PHP: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#110BasicsAnimated: The Guzzle HTTP Client: Requests, Exceptions, Retrie…The Guzzle HTTP Client: Requests, Exceptions, Retries and PSR-18: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#111BasicsAnimated: MVC Architecture: Project Structure and the Request…MVC Architecture: Project Structure and the Request Lifecycle: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#112BasicsAnimated: An MVC Router: The Router Class, Controllers and Nam…An MVC Router: The Router Class, Controllers and Named Routes: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#113BasicsAnimated: Request and Response Objects and the Middleware Pipe…Request and Response Objects and the Middleware Pipeline: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~17s PHP#114BasicsAnimated: Views and Templates: Layouts, Partials and Auto-Esca…Views and Templates: Layouts, Partials and Auto-Escaping: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~18s PHP#115BasicsAnimated: Models and the Data Layer: Active Record, Data Mappe…Models and the Data Layer: Active Record, Data Mapper and Query Builder: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#116BasicsAnimated: SOLID Principles with PHP ExamplesSOLID Principles with PHP Examples: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#117BasicsAnimated: Dependency Injection and a DI Container with AutowiringDependency Injection and a DI Container with Autowiring: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#118BasicsAnimated: Creational Patterns: Singleton, Factory and BuilderCreational Patterns: Singleton, Factory and Builder: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#119BasicsAnimated: Strategy, Observer and Decorator PatternsStrategy, Observer and Decorator Patterns: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#120BasicsAnimated: The Repository Pattern and the Service LayerThe Repository Pattern and the Service Layer: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#121BasicsAnimated: Debugging with Xdebug: Breakpoints, Stepping and Pro…Debugging with Xdebug: Breakpoints, Stepping and Profiling: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#122BasicsAnimated: PHPUnit: First Unit Tests and AssertionsPHPUnit: First Unit Tests and Assertions: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s

Conditions

13
JS#07ConditionsHow does if / else make a choice?See which block runs when a condition is true or false.JavaScript · 4 · ~10s JS#08Conditionselse if — checking several conditions in a rowIn this grading example, conditions are checked top to bottom.JavaScript · 6 · ~13s JS#09Conditionsswitch and breakA short way to compare one value against several options.JavaScript · 6 · ~14s JS#10ConditionsLogical operators: && and ||AND, OR — and the || trick for a default value.JavaScript · 5 · ~13s JS#11ConditionsThe ternary operator: ? :A one-line if/else — choosing one of two values based on a condition.JavaScript · 4 · ~9s PY#07Conditionsif / else and indentationChoosing based on a condition — indentation defines the blocks.Python · 4 · ~10s PY#08Conditionselif — several conditions in a rowConditions are checked top to bottom; the first matching one is chosen.Python · 5 · ~12s PY#09Conditionsmatch / casePython 3.10+ — matching a value against several options.Python · 6 · ~13s PY#10ConditionsLogical operators: and, orAND, OR — and using or to provide a default value.Python · 5 · ~12s PY#11ConditionsConditional expression: x if condition else yA one-line if/else — choosing one of two values.Python · 4 · ~8s PHP#03ConditionsHow does if / else choose a branch?When the condition is false, the else block runs.PHP · 4 · ~8s PHP#04ConditionsThe match expression (PHP 8)The modern form of switch: it returns a value, no break needed.PHP · 6 · ~13s PHP#05Conditions?? — the null coalescing operatorIf the key is missing, a default value is used instead of an error.PHP · 4 · ~11s

Loops

18
JS#12LoopsHow does a for loop work?Counter, condition, and increment — stepping through an array.JavaScript · 9 · ~20s JS#13LoopsThe while loopRepeat while the condition is true — you don't know in advance how many times.JavaScript · 9 · ~19s JS#14Loopsdo...while — at least onceEven if the condition is false from the start, the block runs once.JavaScript · 6 · ~14s JS#15Loopsfor...of — over elementsTaking each array element and summing them without an index.JavaScript · 10 · ~19s JS#17Loopsbreak and continueSkipping a step and stopping a loop early.JavaScript · 10 · ~23s JS#18LoopsNested loopsOn every step of the outer loop, the inner loop runs fully — a multiplication table.JavaScript · 10 · ~20s JS#194LoopsJavaScript: a custom iterableImplement Symbol.iterator and see how for...of calls next() until done: true.JavaScript · 13 · ~36s PY#12Loopsfor loop over a listTaking each element and summing it — without indices.Python · 9 · ~18s PY#13Loopsfor and range()range(start, stop, step) — looping over a sequence of numbers.Python · 8 · ~16s PY#14Loopswhile loopRepeat while the condition is true — how many times isn't known in advance.Python · 9 · ~16s PY#15Loopsbreak and continueSkipping one step and stopping the loop early.Python · 11 · ~22s PY#16Loopsenumerate — looping with a numberGetting the index number along with the element.Python · 7 · ~15s PY#17LoopsNested loopsOn every step of the outer loop, the inner loop runs completely.Python · 9 · ~17s PY#191LoopsCustom iterator: __iter__, __next__, StopIterationBuild a counter that yields one value at a time and see how for resumes its state.Python · 15 · ~37s PHP#06LoopsThe for loopTraversing an array with a counter, condition, and increment.PHP · 8 · ~16s PHP#07LoopsThe while loopRepeats while the condition is true — the number of times isn't known in advance.PHP · 9 · ~17s PHP#08Loopsforeach — array elementsWithout indices: take each element in turn and sum them.PHP · 9 · ~17s PHP#174LoopsPHP: yield generator for pagesFollow a lazy generator that emits rows page by page without building one full result array.PHP · 11 · ~33s

Functions

30
JS#19FunctionsHow does a function call work?An argument goes into the function, and return brings the result back.JavaScript · 5 · ~13s JS#20FunctionsDefault parametersIf no argument is passed, the parameter takes its default value.JavaScript · 7 · ~16s JS#21FunctionsArrow functions (=>)Short syntax: a single-expression function returns a value without writing return.JavaScript · 8 · ~16s JS#22FunctionsCallback — passing a function as an argumentOne function takes another as a parameter and calls it.JavaScript · 7 · ~19s JS#23FunctionsClosureAn inner function that "remembers" a variable even after the outer function has finished.JavaScript · 11 · ~26s JS#24FunctionsRecursion and the call stackfactorial(3): the function calls itself, the stack grows, then unwinds.JavaScript · 10 · ~25s JS#25FunctionsThe call stackWhen one function calls another, who waits for whom?JavaScript · 9 · ~21s JS#132FunctionsAnimated: Functional Style: Pure Functions and ImmutabilityFunctional Style: Pure Functions and Immutability: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#195FunctionsJavaScript: generator and yield*See lazy function* execution, yield* delegation, and resumption after next().JavaScript · 8 · ~24s PY#18FunctionsHow does a function call work?def, parameter, return, and the call frame.Python · 5 · ~12s PY#19FunctionsDefault and keyword argumentsdiscount=10 — used when not provided; can also be passed by name.Python · 7 · ~16s PY#20FunctionsReturning multiple valuesreturn a, b — returned as a tuple and unpacked.Python · 6 · ~13s PY#21FunctionsRecursion and the call stackfactorial(3): the stack grows, stops at the base case, and unwinds.Python · 10 · ~21s PY#22Functionslambda and sorted(key=...)A short anonymous function, and using it to sort a list.Python · 6 · ~14s PY#35FunctionsGenerator and yieldThe function yields a value, pauses, and resumes where it left off.Python · 15 · ~34s PY#61FunctionsAnimated: Functions: Defining, Calling and returnFunctions: Defining, Calling and return: follow a runnable example step by step and see how its data and result change.Python · 5 · ~19s PY#62FunctionsAnimated: Parameters: Positional, Keyword, Defaults, / and *Parameters: Positional, Keyword, Defaults, / and *: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#66FunctionsAnimated: Sorting with key: lambda, itemgetter and Multiple Fi…Sorting with key: lambda, itemgetter and Multiple Fields: follow a runnable example step by step and see how its data and result change.Python · 5 · ~20s PY#68FunctionsAnimated: Decorator Syntax @ and Function WrappersFollow Python decorator syntax with @: the decorator receives a function and returns a wrapper.Python · 11 · ~30s PY#69FunctionsAnimated: Decorators with Arguments and StackingSee how a decorator argument creates a closure and how Python applies stacked @ decorators.Python · 14 · ~38s PY#136FunctionsGenerator: yield from and lazy dataSee when a generator runs, how yield from emits nested items, and why a consumed generator stays empty.Python · 9 · ~26s PY#137FunctionsDecorator: arguments, return value, and @wrapsFollow how a wrapper accepts arguments, calls the original function, and preserves its name.Python · 13 · ~37s PY#138FunctionsParameterized decorator: three function layersFollow repeat(3), its decorator, and the call wrapper; see when each layer runs.Python · 15 · ~39s PHP#10FunctionsHow does a function call work?Parameters, return, and the call frame.PHP · 5 · ~11s PHP#11FunctionsDefault parametersIf no argument is given, the parameter takes its default value.PHP · 7 · ~14s PHP#12FunctionsPassing by value and by reference (&)Why doesn't a regular function change the variable, but &$x does?PHP · 11 · ~23s PHP#13FunctionsRecursion and the call stackfactorial(3): the function calls itself.PHP · 10 · ~20s PHP#45FunctionsAnimated: Anonymous Functions and Closures: use by Value and b…Anonymous Functions and Closures: use by Value and by Reference: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#46FunctionsAnimated: Arrow Functions, the callable Type and First-Class C…Arrow Functions, the callable Type and First-Class Callables: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~24s PHP#52FunctionsAnimated: preg_* Functions: Finding All Matches, Replacing and…preg_* Functions: Finding All Matches, Replacing and Splitting: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s

Arrays

32
JS#26ArraysArray: push and popAdding an element at the end, removing from the end, and length.JavaScript · 6 · ~14s JS#27Arraysmap — transforming each elementCreating a new, transformed array without touching the old one.JavaScript · 7 · ~15s JS#28Arraysfilter — selecting matching elementsEach element is tested: the ones that return true go into a new array.JavaScript · 7 · ~14s JS#29Arraysreduce — folding an array into one valueHow does the accumulator grow step by step?JavaScript · 7 · ~14s JS#30Arraysincludes, indexOf, and findIs the element in the array? Where? Which is the first to match a condition?JavaScript · 5 · ~13s JS#31Arraysslice — cutting a piece from an arrayStart included, end excluded — and the original stays unchanged.JavaScript · 5 · ~11s JS#32ArraysDestructuring and spread (...)"Unpacking" an array into variables, and "spreading" elements into a new array.JavaScript · 5 · ~13s JS#60ArraysAnimated: Arrays: Creation, Indexes, length and at()Arrays: Creation, Indexes, length and at(): follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~16s JS#62ArraysAnimated: RegExp: Quantifiers, Groups and AlternationRegExp: Quantifiers, Groups and Alternation: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#69ArraysAnimated: Set: Unique Values and Set OperationsSet: Unique Values and Set Operations: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~16s JS#73ArraysAnimated: Iterators and IterablesIterators and Iterables: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~16s PY#23ArraysList: append and popAdding an element to the end, removing from the end, and len().Python · 6 · ~12s PY#24ArraysSlicing and negative indices[1:4], [-1], [::2] — ways to take a part of a list.Python · 4 · ~9s PY#25ArraysList comprehensionLoop, filter, and transform — a new list in one line.Python · 9 · ~19s PY#26ArraysLists by reference: b = a is not a copyTwo names for the same list — and a real copy with copy().Python · 8 · ~17s PY#27Arraysset — a collection without duplicatesRemoving duplicates from a list in one step.Python · 9 · ~18s PY#54ArraysAnimated: Lists: Creation, Indexing and SlicingLists: Creation, Indexing and Slicing: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#55ArraysAnimated: Sorting: sort() and sorted()Sorting: sort() and sorted(): follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#56ArraysAnimated: Nested Lists and MatricesNested Lists and Matrices: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#57ArraysAnimated: Tuples and UnpackingTuples and Unpacking: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#59ArraysAnimated: Sets and Set OperationsSets and Set Operations: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#60ArraysAnimated: Nested ComprehensionsNested Comprehensions: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#65ArraysAnimated: map, filter and functools.reducemap, filter and functools.reduce: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#89ArraysAnimated: collections: Counter, defaultdict, namedtuple, dequecollections: Counter, defaultdict, namedtuple, deque: follow a runnable example step by step and see how its data and result change.Python · 5 · ~16s PY#94ArraysAnimated: Regular Expressions: Groups, Substitution and FlagsRegular Expressions: Groups, Substitution and Flags: follow a runnable example step by step and see how its data and result change.Python · 4 · ~15s PHP#14ArraysArray: [] =, array_push, array_popAdding an element to the end, removing from the end, and count().PHP · 6 · ~13s PHP#16Arraysarray_map — transforming every elementCreating a new array with a short fn() function.PHP · 7 · ~16s PHP#17Arraysarray_filter and key preservationSelecting elements by a condition — and the unexpected keys.PHP · 8 · ~16s PHP#41ArraysAnimated: Arrays: Indexed and Associative, Keys and ValuesArrays: Indexed and Associative, Keys and Values: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~16s PHP#42ArraysAnimated: Multidimensional Arrays: Tables, Nested Structures a…Multidimensional Arrays: Tables, Nested Structures and array_column: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~16s PHP#57ArraysAnimated: Filtering and Escaping: filter_var, filter_input and…Filtering and Escaping: filter_var, filter_input and htmlspecialchars: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#78ArraysAnimated: Generators and Iterators: yield, IteratorAggregate a…Generators and Iterators: yield, IteratorAggregate and Collections: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~16s

Objects

8

Strings

18
JS#04StringsTemplate literalsEmbedding variables into a string using backticks and ${...}.JavaScript · 5 · ~12s JS#36StringsString methods: trim, toUpperCase, sliceRemoving spaces, converting to uppercase, and cutting out a part.JavaScript · 5 · ~13s JS#37StringsReversing a stringThe split → reverse → join chain, step by step.JavaScript · 5 · ~12s JS#89StringsAnimated: Element Content: textContent, innerHTML and innerTextElement Content: textContent, innerHTML and innerText: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s PY#04Stringsf-strings (f-string)Embedding variables directly into a string using {}.Python · 5 · ~11s PY#30StringsString methods: strip, upper, sliceRemoving spaces, converting to uppercase, and cutting out a part.Python · 5 · ~11s PY#31StringsReversing a string: [::-1]A slice with a negative step, and a palindrome check.Python · 5 · ~11s PY#49StringsAnimated: Strings: Creation, Escaping and Basic OperationsStrings: Creation, Escaping and Basic Operations: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#50StringsAnimated: f-strings: Embedding Expressions and Debuggingf-strings: Embedding Expressions and Debugging: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#51StringsAnimated: Formatting Numbers and Text: Format SpecifiersFormatting Numbers and Text: Format Specifiers: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PY#52StringsAnimated: Unicode and Encodings: ord, chr, encode, decodeUnicode and Encodings: ord, chr, encode, decode: follow a runnable example step by step and see how its data and result change.Python · 5 · ~18s PHP#02StringsConcatenating strings: the dot (.)In PHP, strings are joined with the dot operator, not +.PHP · 5 · ~12s PHP#18Stringsexplode and implodeSplitting a string into an array and joining it back into a string.PHP · 4 · ~10s PHP#19StringsString functions and the mb_ surprisetrim, strlen vs mb_strlen, mb_strtoupper, str_replace.PHP · 6 · ~15s PHP#36StringsAnimated: Strings: Quotes, Escaping, Interpolation, Heredoc an…Strings: Quotes, Escaping, Interpolation, Heredoc and Nowdoc: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~18s PHP#37StringsAnimated: Search and Replace: str_contains, strpos, substr and…Search and Replace: str_contains, strpos, substr and str_replace: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~18s PHP#38StringsAnimated: Formatting Output: printf, sprintf and number_formatFormatting Output: printf, sprintf and number_format: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~18s PHP#39StringsAnimated: Unicode and mb_* Functions: Handling Non-Latin LettersUnicode and mb_* Functions: Handling Non-Latin Letters: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~18s

OOP

25
JS#38OOPClass, constructor, and thisCreating an object with new and calling a method.JavaScript · 8 · ~20s JS#39OOPInheritance: extends and superA child class extends the parent's method.JavaScript · 9 · ~23s JS#58OOPAnimated: Objects: Literals, Properties, Dot and Bracket NotationObjects: Literals, Properties, Dot and Bracket Notation: follow a runnable example step by step and see how its data and result change.JavaScript · 6 · ~23s JS#63OOPAnimated: RegExp in Practice: match, matchAll, replace and Val…RegExp in Practice: match, matchAll, replace and Validation: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#77OOPAnimated: Constructor Functions and the new OperatorConstructor Functions and the new Operator: follow a runnable example step by step and see how its data and result change.JavaScript · 6 · ~22s JS#82OOPAnimated: Private Fields and Methods with #Private Fields and Methods with #: follow a runnable example step by step and see how its data and result change.JavaScript · 6 · ~22s PY#32OOPClass, __init__, and selfCreating an object and calling a method.Python · 8 · ~18s PY#33OOPInheritance and super()A child class extends the parent's method.Python · 9 · ~20s PY#43OOPAnimated: Dynamic Typing: Objects, Types and ReferencesDynamic Typing: Objects, Types and References: follow a runnable example step by step and see how its data and result change.Python · 8 · ~32s PY#97OOPAnimated: Classes and Objects: Why OOPClasses and Objects: Why OOP: follow a runnable example step by step and see how its data and result change.Python · 8 · ~31s PY#99OOPAnimated: Instance MethodsInstance Methods: follow a runnable example step by step and see how its data and result change.Python · 8 · ~28s PY#189OOPOOP in practice: account balance invariantFollow object state, construction, methods, and a rule that prevents a negative balance.Python · 18 · ~50s PY#190OOPOOP: polymorphism without type checksTwo classes expose area() to one loop; compare their state and behavior.Python · 15 · ~39s PHP#20OOPClass, __construct, and $thisCreating an object with new and calling a method with ->.PHP · 8 · ~18s PHP#21OOPInheritance: extends and parent::A child class extends the parent's method.PHP · 8 · ~20s PHP#66OOPAnimated: Classes and Objects: Properties, Methods, $this and…Classes and Objects: Properties, Methods, $this and the ?-> Operator: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#67OOPAnimated: Constructors, Property Promotion and Typed PropertiesConstructors, Property Promotion and Typed Properties: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#68OOPAnimated: Encapsulation: public, protected, private and Object…Encapsulation: public, protected, private and Object Invariants: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#69OOPAnimated: Static Properties and Methods, Class Constants and s…Static Properties and Methods, Class Constants and self::: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#70OOPAnimated: Abstract Classes and Methods: The Template MethodAbstract Classes and Methods: The Template Method: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#71OOPAnimated: Interfaces, Polymorphism and instanceofInterfaces, Polymorphism and instanceof: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~22s PHP#72OOPAnimated: Traits: Code Reuse and Conflict ResolutionTraits: Code Reuse and Conflict Resolution: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#75OOPAnimated: Property Hooks and Asymmetric Visibility in PHP 8.4Property Hooks and Asymmetric Visibility in PHP 8.4: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#76OOPAnimated: Magic Methods and Cloning: __toString, __get, __call…Magic Methods and Cloning: __toString, __get, __call, __invoke, __clone: follow a runnable example step by step and see how its data and result change.PHP · 6 · ~23s PHP#173OOPPHP OOP: objects and state protectionUse an account to follow construction, a private field, methods, and a balance check before withdrawal.PHP · 17 · ~46s

Errors

13
JS#40Errorstry / catch — catching an errorthrow raises an error, catch handles it, and the program doesn't crash.JavaScript · 11 · ~24s JS#83ErrorsAnimated: Custom Error Classes: extends ErrorCustom Error Classes: extends Error: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#85ErrorsAnimated: Common Errors and Debugging StrategiesCommon Errors and Debugging Strategies: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s PY#34Errorstry / except — catching an exceptionThe division-by-zero error is caught, and the program doesn't crash.Python · 9 · ~19s PY#41ErrorsAnimated: Reading Errors: Tracebacks and Common Beginner MistakesReading Errors: Tracebacks and Common Beginner Mistakes: follow a runnable example step by step and see how its data and result change.Python · 8 · ~30s PY#73ErrorsAnimated: Raising Exceptions: raise, raise from and assertRaising Exceptions: raise, raise from and assert: follow a runnable example step by step and see how its data and result change.Python · 8 · ~30s PY#74ErrorsAnimated: Custom Exception ClassesCustom Exception Classes: follow a runnable example step by step and see how its data and result change.Python · 8 · ~29s PY#120ErrorsAnimated: Reliable HTTP Requests: Timeouts, Errors and RetriesReliable HTTP Requests: Timeouts, Errors and Retries: follow a runnable example step by step and see how its data and result change.Python · 6 · ~21s PHP#22Errorstry / catch and Exceptionthrow raises an exception, catch handles it — the program doesn't crash.PHP · 11 · ~24s PHP#27ErrorsAnimated: Configuring php.ini, phpinfo() and Displaying ErrorsConfiguring php.ini, phpinfo() and Displaying Errors: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~21s PHP#80ErrorsAnimated: The Throwable Hierarchy: Error, Exception and SPL Ex…The Throwable Hierarchy: Error, Exception and SPL Exceptions: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~21s PHP#81ErrorsAnimated: Custom Exceptions: Hierarchy, Context and the previo…Custom Exceptions: Hierarchy, Context and the previous Chain: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~21s PHP#82ErrorsAnimated: Global Error Handling: Handlers, Strategy and error_logGlobal Error Handling: Handlers, Strategy and error_log: follow a runnable example step by step and see how its data and result change.PHP · 5 · ~21s

Async

37
JS#41AsyncsetTimeout and the event loopWhy does even a 0 ms timer fire last?JavaScript · 6 · ~17s JS#42AsyncPromise and thenA result that will be ready in the future: pending → fulfilled.JavaScript · 7 · ~20s JS#43Asyncasync / awaitawait pauses the function, but doesn't freeze the program.JavaScript · 8 · ~21s JS#45AsyncAnimated: Adding JavaScript to a Page: script, defer, async an…Adding JavaScript to a Page: script, defer, async and Modules: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#55AsyncAnimated: Callbacks and Higher-Order FunctionsCallbacks and Higher-Order Functions: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#86AsyncAnimated: What the DOM Is: the Node Tree and documentWhat the DOM Is: the Node Tree and document: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#87AsyncAnimated: Selecting Elements: querySelector, getElementById, c…Selecting Elements: querySelector, getElementById, closest: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#88AsyncAnimated: Traversing the DOM: Parents, Children and SiblingsTraversing the DOM: Parents, Children and Siblings: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#90AsyncAnimated: Attributes and Properties: getAttribute, setAttribut…Attributes and Properties: getAttribute, setAttribute, dataset: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#91AsyncAnimated: classList and Styles: Managing Classes and CSSclassList and Styles: Managing Classes and CSS: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#92AsyncAnimated: Creating, Inserting and Removing ElementsCreating, Inserting and Removing Elements: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#93AsyncAnimated: Sizes and Scrolling: getBoundingClientRect and scrol…Sizes and Scrolling: getBoundingClientRect and scrollIntoView: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#94AsyncAnimated: Event Listeners: addEventListener and removeEventLis…Event Listeners: addEventListener and removeEventListener: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#95AsyncAnimated: Event Propagation: Bubbling and CapturingEvent Propagation: Bubbling and Capturing: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#96AsyncAnimated: Event DelegationEvent Delegation: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~19s JS#97AsyncAnimated: Mouse and Pointer EventsMouse and Pointer Events: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#98AsyncAnimated: Keyboard Events: keydown, key and codeKeyboard Events: keydown, key and code: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#99AsyncAnimated: Page Lifecycle: DOMContentLoaded, load, scroll and r…Page Lifecycle: DOMContentLoaded, load, scroll and resize: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#100AsyncAnimated: Custom Events: CustomEvent and dispatchEventCustom Events: CustomEvent and dispatchEvent: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~22s JS#101AsyncAnimated: Working with Forms: form.elements, value, checked an…Working with Forms: form.elements, value, checked and select: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#102AsyncAnimated: Form Events: submit, input, change and FormDataForm Events: submit, input, change and FormData: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#104AsyncAnimated: Custom Validation in JavaScript: Rules and Error Mes…Custom Validation in JavaScript: Rules and Error Messages: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#108AsyncAnimated: Asynchronous Callbacks and Callback HellAsynchronous Callbacks and Callback Hell: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#109AsyncAnimated: Promises: States, then, catch and finallyPromises: States, then, catch and finally: follow a runnable example step by step and see how its data and result change.JavaScript · 2 · ~7s JS#110AsyncAnimated: Async Error Handling: Parallel vs Sequential ExecutionAsync Error Handling: Parallel vs Sequential Execution: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#112AsyncAnimated: GET Requests with fetch: Response, json() and URLSea…GET Requests with fetch: Response, json() and URLSearchParams: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~17s JS#113AsyncAnimated: Sending Data: POST, PUT, PATCH and DELETESending Data: POST, PUT, PATCH and DELETE: follow a runnable example step by step and see how its data and result change.JavaScript · 2 · ~7s JS#114AsyncAnimated: Network Errors, Timeouts and AbortControllerNetwork Errors, Timeouts and AbortController: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~20s JS#137AsyncAnimated: Event Delegation for Handling Browser EventsEvent Delegation for Handling Browser Events: follow a runnable example step by step and see how its data and result change.JavaScript · 5 · ~21s JS#138AsyncAnimated: Canceling a Request with AbortControllerCanceling a Request with AbortController: follow a runnable example step by step and see how its data and result change.JavaScript · 2 · ~7s JS#140AsyncAnimated: Form Validation and Error FeedbackForm Validation and Error Feedback: follow a runnable example step by step and see how its data and result change.JavaScript · 3 · ~11s JS#143AsyncAnimated: Retrying a Promise with BackoffRetrying a Promise with Backoff: follow a runnable example step by step and see how its data and result change.JavaScript · 2 · ~7s PY#128AsyncAnimated: Concurrency and Parallelism: Threads, Processes, asy…Concurrency and Parallelism: Threads, Processes, asyncio and the GIL: follow a runnable example step by step and see how its data and result change.Python · 8 · ~28s PY#133AsyncAnimated: Async HTTP Requests: httpx.AsyncClient and aiohttpAsync HTTP Requests: httpx.AsyncClient and aiohttp: follow a runnable example step by step and see how its data and result change.Python · 6 · ~21s PHP#55AsyncAnimated: POST Forms: Submitting Data, Array Fields and the PR…POST Forms: Submitting Data, Array Fields and the PRG Pattern: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#56AsyncAnimated: Form Validation: Required Fields, Formats and Error…Form Validation: Required Fields, Formats and Error Messages: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~11s PHP#95AsyncAnimated: Fetching Results: fetch, fetchAll, fetchColumn and F…Fetching Results: fetch, fetchAll, fetchColumn and Fetch Modes: follow a runnable example step by step and see how its data and result change.PHP · 3 · ~12s

Algorithm complexity

30
JS#154Algorithm complexityArray element accessStep-by-step analysis: O(1) time and O(1) extra space. Follow the code and each bound.JavaScript · 4 · ~12s JS#155Algorithm complexityFind a maximum in one passStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.JavaScript · 5 · ~16s JS#156Algorithm complexityBinary search in a sorted arrayStep-by-step analysis: O(log n) time and O(1) extra space. Follow the code and each bound.JavaScript · 6 · ~19s JS#157Algorithm complexityAll pairs: why O(n²)Step-by-step analysis: O(n²) time and O(1) extra space. Follow the code and each bound.JavaScript · 5 · ~16s JS#158Algorithm complexityMerge two sorted arraysStep-by-step analysis: O(n+m) time and O(n+m) extra space. Follow the code and each bound.JavaScript · 6 · ~19s JS#159Algorithm complexityTwo pointers: target sumStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.JavaScript · 5 · ~17s JS#160Algorithm complexityFrequencies with a mapStep-by-step analysis: O(n) average time and O(k) extra space. Follow the code and each bound.JavaScript · 5 · ~17s JS#161Algorithm complexityMerge sort: O(n log n)Step-by-step analysis: O(n log n) time and O(n) extra space. Follow the code and each bound.JavaScript · 6 · ~19s JS#162Algorithm complexityNaive Fibonacci recursionStep-by-step analysis: O(2^n) upper bound time and O(n) extra space. Follow the code and each bound.JavaScript · 5 · ~18s JS#163Algorithm complexityPermutations: factorial searchStep-by-step analysis: O(n·n!) time and O(n) extra space. Follow the code and each bound.JavaScript · 7 · ~22s PY#149Algorithm complexityArray element accessStep-by-step analysis: O(1) time and O(1) extra space. Follow the code and each bound.Python · 4 · ~12s PY#150Algorithm complexityFind a maximum in one passStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.Python · 5 · ~16s PY#151Algorithm complexityBinary search in a sorted arrayStep-by-step analysis: O(log n) time and O(1) extra space. Follow the code and each bound.Python · 6 · ~19s PY#152Algorithm complexityAll pairs: why O(n²)Step-by-step analysis: O(n²) time and O(1) extra space. Follow the code and each bound.Python · 5 · ~16s PY#153Algorithm complexityMerge two sorted arraysStep-by-step analysis: O(n+m) time and O(n+m) extra space. Follow the code and each bound.Python · 6 · ~19s PY#154Algorithm complexityTwo pointers: target sumStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.Python · 5 · ~17s PY#155Algorithm complexityFrequencies with a mapStep-by-step analysis: O(n) average time and O(k) extra space. Follow the code and each bound.Python · 5 · ~17s PY#156Algorithm complexityMerge sort: O(n log n)Step-by-step analysis: O(n log n) time and O(n) extra space. Follow the code and each bound.Python · 6 · ~19s PY#157Algorithm complexityNaive Fibonacci recursionStep-by-step analysis: O(2^n) upper bound time and O(n) extra space. Follow the code and each bound.Python · 5 · ~18s PY#158Algorithm complexityPermutations: factorial searchStep-by-step analysis: O(n·n!) time and O(n) extra space. Follow the code and each bound.Python · 7 · ~22s PHP#133Algorithm complexityArray element accessPHP array lookup: average O(1) time and O(1) extra space. See the hash-table caveat.PHP · 4 · ~13s PHP#134Algorithm complexityFind a maximum in one passStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.PHP · 5 · ~16s PHP#135Algorithm complexityBinary search in a sorted arrayStep-by-step analysis: O(log n) time and O(1) extra space. Follow the code and each bound.PHP · 6 · ~19s PHP#136Algorithm complexityAll pairs: why O(n²)Step-by-step analysis: O(n²) time and O(1) extra space. Follow the code and each bound.PHP · 5 · ~16s PHP#137Algorithm complexityMerge two sorted arraysStep-by-step analysis: O(n+m) time and O(n+m) extra space. Follow the code and each bound.PHP · 6 · ~19s PHP#138Algorithm complexityTwo pointers: target sumStep-by-step analysis: O(n) time and O(1) extra space. Follow the code and each bound.PHP · 5 · ~17s PHP#139Algorithm complexityFrequencies with a mapStep-by-step analysis: O(n) average time and O(k) extra space. Follow the code and each bound.PHP · 5 · ~17s PHP#140Algorithm complexityMerge sort: O(n log n)Step-by-step analysis: O(n log n) time and O(n) extra space. Follow the code and each bound.PHP · 6 · ~19s PHP#141Algorithm complexityNaive Fibonacci recursionStep-by-step analysis: O(2^n) upper bound time and O(n) extra space. Follow the code and each bound.PHP · 5 · ~18s PHP#142Algorithm complexityPermutations: factorial searchStep-by-step analysis: O(n·n!) time and O(n) extra space. Follow the code and each bound.PHP · 7 · ~22s
30
JS#164Search algorithmsLinear search: first matchSearch walkthrough: O(n) time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~17s JS#165Search algorithmsBinary search: halve the rangeSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~16s JS#166Search algorithmsJump search in a sorted arraySearch walkthrough: O(√n) time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~15s JS#167Search algorithmsExponential search: bounds 1, 2, 4…Search walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~17s JS#168Search algorithmsInterpolation search: estimate a positionSearch walkthrough: O(log log n) average on uniform data; O(n) worst time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~17s JS#169Search algorithmsFirst occurrence: lower boundSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.JavaScript · 6 · ~21s JS#170Search algorithmsSearch a rotated sorted arraySearch walkthrough: O(log n) with distinct values time and O(1) extra space. Follow the preconditions and each step.JavaScript · 5 · ~19s JS#171Search algorithmsSubstring search: compare charactersSearch walkthrough: O(n·m) worst time and O(1) extra space. Follow the preconditions and each step.JavaScript · 6 · ~19s JS#172Search algorithmsBreadth-first search: shortest edge countSearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.JavaScript · 6 · ~21s JS#173Search algorithmsDepth-first search: stack and reachabilitySearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.JavaScript · 6 · ~21s PY#159Search algorithmsLinear search: first matchSearch walkthrough: O(n) time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~17s PY#160Search algorithmsBinary search: halve the rangeSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~16s PY#161Search algorithmsJump search in a sorted arraySearch walkthrough: O(√n) time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~15s PY#162Search algorithmsExponential search: bounds 1, 2, 4…Search walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~17s PY#163Search algorithmsInterpolation search: estimate a positionSearch walkthrough: O(log log n) average on uniform data; O(n) worst time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~17s PY#164Search algorithmsFirst occurrence: lower boundSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.Python · 6 · ~21s PY#165Search algorithmsSearch a rotated sorted arraySearch walkthrough: O(log n) with distinct values time and O(1) extra space. Follow the preconditions and each step.Python · 5 · ~19s PY#166Search algorithmsSubstring search: compare charactersSearch walkthrough: O(n·m) worst time and O(1) extra space. Follow the preconditions and each step.Python · 6 · ~19s PY#167Search algorithmsBreadth-first search: shortest edge countSearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.Python · 6 · ~21s PY#168Search algorithmsDepth-first search: stack and reachabilitySearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.Python · 6 · ~21s PHP#143Search algorithmsLinear search: first matchSearch walkthrough: O(n) time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~17s PHP#144Search algorithmsBinary search: halve the rangeSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~16s PHP#145Search algorithmsJump search in a sorted arraySearch walkthrough: O(√n) time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~15s PHP#146Search algorithmsExponential search: bounds 1, 2, 4…Search walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~17s PHP#147Search algorithmsInterpolation search: estimate a positionSearch walkthrough: O(log log n) average on uniform data; O(n) worst time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~17s PHP#148Search algorithmsFirst occurrence: lower boundSearch walkthrough: O(log n) time and O(1) extra space. Follow the preconditions and each step.PHP · 6 · ~21s PHP#149Search algorithmsSearch a rotated sorted arraySearch walkthrough: O(log n) with distinct values time and O(1) extra space. Follow the preconditions and each step.PHP · 5 · ~19s PHP#150Search algorithmsSubstring search: compare charactersSearch walkthrough: O(n·m) worst time and O(1) extra space. Follow the preconditions and each step.PHP · 6 · ~19s PHP#151Search algorithmsBreadth-first search: shortest edge countSearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.PHP · 6 · ~21s PHP#152Search algorithmsDepth-first search: stack and reachabilitySearch walkthrough: O(V+E) time and O(V) extra space. Follow the preconditions and each step.PHP · 6 · ~21s

Sorting algorithms

30
JS#174Sorting algorithmsBubble sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s JS#175Sorting algorithmsSelection sortSorting walkthrough: O(n²) time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 5 · ~16s JS#176Sorting algorithmsInsertion sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s JS#177Sorting algorithmsMerge sort: divide and mergeSorting walkthrough: O(n log n) time and O(n) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s JS#178Sorting algorithmsQuicksort: partition around a pivotSorting walkthrough: O(n log n) average; O(n²) worst time and O(log n) average stack; O(n) worst extra space. Watch the array change and note the constraints.JavaScript · 5 · ~17s JS#179Sorting algorithmsHeap sortSorting walkthrough: O(n log n) time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 7 · ~25s JS#180Sorting algorithmsCounting sort for a small value rangeSorting walkthrough: O(n+k) time and O(n+k) extra space. Watch the array change and note the constraints.JavaScript · 5 · ~17s JS#181Sorting algorithmsLSD radix sortSorting walkthrough: O(d·(n+10)) time and O(n+10) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s JS#182Sorting algorithmsShell sort: shrinking gapsSorting walkthrough: O(n²) worst with halving gaps time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s JS#183Sorting algorithmsCocktail sort: scan in both directionsSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.JavaScript · 6 · ~20s PY#169Sorting algorithmsBubble sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PY#170Sorting algorithmsSelection sortSorting walkthrough: O(n²) time and O(1) extra space. Watch the array change and note the constraints.Python · 5 · ~16s PY#171Sorting algorithmsInsertion sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PY#172Sorting algorithmsMerge sort: divide and mergeSorting walkthrough: O(n log n) time and O(n) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PY#173Sorting algorithmsQuicksort: partition around a pivotSorting walkthrough: O(n log n) average; O(n²) worst time and O(log n) average stack; O(n) worst extra space. Watch the array change and note the constraints.Python · 5 · ~17s PY#174Sorting algorithmsHeap sortSorting walkthrough: O(n log n) time and O(1) extra space. Watch the array change and note the constraints.Python · 7 · ~25s PY#175Sorting algorithmsCounting sort for a small value rangeSorting walkthrough: O(n+k) time and O(n+k) extra space. Watch the array change and note the constraints.Python · 5 · ~17s PY#176Sorting algorithmsLSD radix sortSorting walkthrough: O(d·(n+10)) time and O(n+10) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PY#177Sorting algorithmsShell sort: shrinking gapsSorting walkthrough: O(n²) worst with halving gaps time and O(1) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PY#178Sorting algorithmsCocktail sort: scan in both directionsSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.Python · 6 · ~20s PHP#153Sorting algorithmsBubble sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s PHP#154Sorting algorithmsSelection sortSorting walkthrough: O(n²) time and O(1) extra space. Watch the array change and note the constraints.PHP · 5 · ~16s PHP#155Sorting algorithmsInsertion sortSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s PHP#156Sorting algorithmsMerge sort: divide and mergeSorting walkthrough: O(n log n) time and O(n) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s PHP#157Sorting algorithmsQuicksort: partition around a pivotSorting walkthrough: O(n log n) average; O(n²) worst time and O(log n) average stack; O(n) worst extra space. Watch the array change and note the constraints.PHP · 5 · ~17s PHP#158Sorting algorithmsHeap sortSorting walkthrough: O(n log n) time and O(1) extra space. Watch the array change and note the constraints.PHP · 7 · ~25s PHP#159Sorting algorithmsCounting sort for a small value rangeSorting walkthrough: O(n+k) time and O(n+k) extra space. Watch the array change and note the constraints.PHP · 5 · ~17s PHP#160Sorting algorithmsLSD radix sortSorting walkthrough: O(d·(n+10)) time and O(n+10) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s PHP#161Sorting algorithmsShell sort: shrinking gapsSorting walkthrough: O(n²) worst with halving gaps time and O(1) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s PHP#162Sorting algorithmsCocktail sort: scan in both directionsSorting walkthrough: O(n²) worst; O(n) best time and O(1) extra space. Watch the array change and note the constraints.PHP · 6 · ~20s

Data structures

30
JS#184Data structuresStack: last in, first outStep-by-step data structure example: push amortized O(1), pop O(1); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~15s JS#185Data structuresQueue: first in, first outStep-by-step data structure example: enqueue amortized O(1), dequeue O(1); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~15s JS#186Data structuresDeque: operations at both endsStep-by-step data structure example: O(1) at either end (average for maps); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~17s JS#187Data structuresSingly linked list: nodes and linksStep-by-step data structure example: prepend O(1), search O(n); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~16s JS#188Data structuresHash map: key → valueStep-by-step data structure example: get/set average O(1); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~15s JS#189Data structuresSet: uniqueness and membershipStep-by-step data structure example: add/contains average O(1); O(n) space. Follow each operation and its cost.JavaScript · 5 · ~15s JS#190Data structuresMin heap: priority queueStep-by-step data structure example: insert/extract O(log n), peek O(1); O(n) space. Follow each operation and its cost.JavaScript · 6 · ~19s JS#191Data structuresUnbalanced binary search treeStep-by-step data structure example: search/insert O(log n) balanced, O(n) worst; O(n) space. Follow each operation and its cost.JavaScript · 5 · ~17s JS#192Data structuresTrie: a string prefix treeStep-by-step data structure example: insert/lookup O(L) average; O(total characters) space. Follow each operation and its cost.JavaScript · 7 · ~25s JS#193Data structuresGraph: adjacency listsStep-by-step data structure example: add edge amortized O(1), list neighbors O(degree); O(V+E) space. Follow each operation and its cost.JavaScript · 6 · ~20s PY#179Data structuresStack: last in, first outStep-by-step data structure example: push amortized O(1), pop O(1); O(n) space. Follow each operation and its cost.Python · 5 · ~15s PY#180Data structuresQueue: first in, first outStep-by-step data structure example: enqueue amortized O(1), dequeue O(1); O(n) space. Follow each operation and its cost.Python · 5 · ~15s PY#181Data structuresDeque: operations at both endsStep-by-step data structure example: O(1) at either end (average for maps); O(n) space. Follow each operation and its cost.Python · 5 · ~17s PY#182Data structuresSingly linked list: nodes and linksStep-by-step data structure example: prepend O(1), search O(n); O(n) space. Follow each operation and its cost.Python · 5 · ~16s PY#183Data structuresHash map: key → valueStep-by-step data structure example: get/set average O(1); O(n) space. Follow each operation and its cost.Python · 5 · ~15s PY#184Data structuresSet: uniqueness and membershipStep-by-step data structure example: add/contains average O(1); O(n) space. Follow each operation and its cost.Python · 5 · ~15s PY#185Data structuresMin heap: priority queueStep-by-step data structure example: insert/extract O(log n), peek O(1); O(n) space. Follow each operation and its cost.Python · 6 · ~19s PY#186Data structuresUnbalanced binary search treeStep-by-step data structure example: search/insert O(log n) balanced, O(n) worst; O(n) space. Follow each operation and its cost.Python · 5 · ~17s PY#187Data structuresTrie: a string prefix treeStep-by-step data structure example: insert/lookup O(L) average; O(total characters) space. Follow each operation and its cost.Python · 7 · ~25s PY#188Data structuresGraph: adjacency listsStep-by-step data structure example: add edge amortized O(1), list neighbors O(degree); O(V+E) space. Follow each operation and its cost.Python · 6 · ~20s PHP#163Data structuresStack: last in, first outStep-by-step data structure example: push amortized O(1), pop O(1); O(n) space. Follow each operation and its cost.PHP · 5 · ~15s PHP#164Data structuresQueue: first in, first outStep-by-step data structure example: enqueue amortized O(1), dequeue O(1); O(n) space. Follow each operation and its cost.PHP · 5 · ~15s PHP#165Data structuresDeque: operations at both endsStep-by-step data structure example: O(1) at either end (average for maps); O(n) space. Follow each operation and its cost.PHP · 5 · ~17s PHP#166Data structuresSingly linked list: nodes and linksStep-by-step data structure example: prepend O(1), search O(n); O(n) space. Follow each operation and its cost.PHP · 5 · ~16s PHP#167Data structuresHash map: key → valueStep-by-step data structure example: get/set average O(1); O(n) space. Follow each operation and its cost.PHP · 5 · ~15s PHP#168Data structuresSet: uniqueness and membershipStep-by-step data structure example: add/contains average O(1); O(n) space. Follow each operation and its cost.PHP · 5 · ~15s PHP#169Data structuresMin heap: priority queueStep-by-step data structure example: insert/extract O(log n), peek O(1); O(n) space. Follow each operation and its cost.PHP · 6 · ~19s PHP#170Data structuresUnbalanced binary search treeStep-by-step data structure example: search/insert O(log n) balanced, O(n) worst; O(n) space. Follow each operation and its cost.PHP · 5 · ~17s PHP#171Data structuresTrie: a string prefix treeStep-by-step data structure example: insert/lookup O(L) average; O(total characters) space. Follow each operation and its cost.PHP · 7 · ~25s PHP#172Data structuresGraph: adjacency listsStep-by-step data structure example: add edge amortized O(1), list neighbors O(degree); O(V+E) space. Follow each operation and its cost.PHP · 6 · ~20s

Abstract data types

30
JS#144Abstract data typesList ADT: positions and orderADT contract and implementation: array insert/remove O(n), access O(1) average; O(n) space. Follow the operations and rules.JavaScript · 5 · ~18s JS#145Abstract data typesStack ADT: push, pop, and peekADT contract and implementation: push amortized O(1), pop/peek O(1); O(n) space. Follow the operations and rules.JavaScript · 5 · ~15s JS#146Abstract data typesQueue ADT: enqueue, dequeue, and frontADT contract and implementation: enqueue amortized O(1), dequeue/front O(1); O(n) space. Follow the operations and rules.JavaScript · 5 · ~16s JS#147Abstract data typesPriority Queue ADT: lowest priority firstADT contract and implementation: cost depends on implementation; O(n) space. Follow the operations and rules.JavaScript · 5 · ~18s JS#148Abstract data typesSet ADT: union and intersectionADT contract and implementation: union/intersection O(n+m) average; O(n+m) space. Follow the operations and rules.JavaScript · 5 · ~16s JS#149Abstract data typesMap ADT: put, get, containsKeyADT contract and implementation: put/get/contains average O(1); O(n) space. Follow the operations and rules.JavaScript · 5 · ~16s JS#150Abstract data typesMultiset ADT: count duplicatesADT contract and implementation: add/remove/count average O(1); O(k) space. Follow the operations and rules.JavaScript · 5 · ~17s JS#151Abstract data typesDisjoint Set ADT: union and findADT contract and implementation: amortized O(α(n)) per operation; O(n) space. Follow the operations and rules.JavaScript · 7 · ~23s JS#152Abstract data typesGraph ADT: vertices, edges, neighborsADT contract and implementation: add/has edge average O(1), neighbors O(degree); O(V+E) space. Follow the operations and rules.JavaScript · 5 · ~18s JS#153Abstract data typesTree ADT: parent and childrenADT contract and implementation: add child amortized O(1), traversal O(n); O(n) space. Follow the operations and rules.JavaScript · 6 · ~19s PY#139Abstract data typesList ADT: positions and orderADT contract and implementation: array insert/remove O(n), access O(1) average; O(n) space. Follow the operations and rules.Python · 5 · ~18s PY#140Abstract data typesStack ADT: push, pop, and peekADT contract and implementation: push amortized O(1), pop/peek O(1); O(n) space. Follow the operations and rules.Python · 5 · ~15s PY#141Abstract data typesQueue ADT: enqueue, dequeue, and frontADT contract and implementation: enqueue amortized O(1), dequeue/front O(1); O(n) space. Follow the operations and rules.Python · 5 · ~16s PY#142Abstract data typesPriority Queue ADT: lowest priority firstADT contract and implementation: cost depends on implementation; O(n) space. Follow the operations and rules.Python · 5 · ~18s PY#143Abstract data typesSet ADT: union and intersectionADT contract and implementation: union/intersection O(n+m) average; O(n+m) space. Follow the operations and rules.Python · 5 · ~16s PY#144Abstract data typesMap ADT: put, get, containsKeyADT contract and implementation: put/get/contains average O(1); O(n) space. Follow the operations and rules.Python · 5 · ~16s PY#145Abstract data typesMultiset ADT: count duplicatesADT contract and implementation: add/remove/count average O(1); O(k) space. Follow the operations and rules.Python · 5 · ~17s PY#146Abstract data typesDisjoint Set ADT: union and findADT contract and implementation: amortized O(α(n)) per operation; O(n) space. Follow the operations and rules.Python · 7 · ~23s PY#147Abstract data typesGraph ADT: vertices, edges, neighborsADT contract and implementation: add/has edge average O(1), neighbors O(degree); O(V+E) space. Follow the operations and rules.Python · 5 · ~18s PY#148Abstract data typesTree ADT: parent and childrenADT contract and implementation: add child amortized O(1), traversal O(n); O(n) space. Follow the operations and rules.Python · 6 · ~19s PHP#123Abstract data typesList ADT: positions and orderADT contract and implementation: array insert/remove O(n), access O(1) average; O(n) space. Follow the operations and rules.PHP · 5 · ~18s PHP#124Abstract data typesStack ADT: push, pop, and peekADT contract and implementation: push amortized O(1), pop/peek O(1); O(n) space. Follow the operations and rules.PHP · 5 · ~15s PHP#125Abstract data typesQueue ADT: enqueue, dequeue, and frontADT contract and implementation: enqueue amortized O(1), dequeue/front O(1); O(n) space. Follow the operations and rules.PHP · 5 · ~16s PHP#126Abstract data typesPriority Queue ADT: lowest priority firstADT contract and implementation: cost depends on implementation; O(n) space. Follow the operations and rules.PHP · 5 · ~18s PHP#127Abstract data typesSet ADT: union and intersectionADT contract and implementation: union/intersection O(n+m) average; O(n+m) space. Follow the operations and rules.PHP · 5 · ~16s PHP#128Abstract data typesMap ADT: put, get, containsKeyADT contract and implementation: put/get/contains average O(1); O(n) space. Follow the operations and rules.PHP · 5 · ~16s PHP#129Abstract data typesMultiset ADT: count duplicatesADT contract and implementation: add/remove/count average O(1); O(k) space. Follow the operations and rules.PHP · 5 · ~17s PHP#130Abstract data typesDisjoint Set ADT: union and findADT contract and implementation: amortized O(α(n)) per operation; O(n) space. Follow the operations and rules.PHP · 7 · ~23s PHP#131Abstract data typesGraph ADT: vertices, edges, neighborsADT contract and implementation: add/has edge average O(1), neighbors O(degree); O(V+E) space. Follow the operations and rules.PHP · 5 · ~18s PHP#132Abstract data typesTree ADT: parent and childrenADT contract and implementation: add child amortized O(1), traversal O(n); O(n) space. Follow the operations and rules.PHP · 6 · ~19s

No matching videos — try a different search or language.

56 exercises

Programming practice

Solve a short task in the editor, check the requirements, then open the step-by-step explanation. The checker does not execute code; it looks for key parts of your solution.

JS #01

Functions and return

Write total(price, quantity) to return an order total. Four items at 7.5 each should produce 30.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

The function receives two arguments. It multiplies them and uses return to pass the result back to its caller. Return the number itself; printing it with console.log is a different operation.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

function total(price, quantity) {
  return price * quantity;
}

console.log(total(7.5, 4));
JS #02

Checking a condition with if / else

Set score to 72. Print Passed when it is at least 60; otherwise print Try again.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

The condition evaluates to true or false, so only one branch runs. “At least 60” means >= 60; using > 60 would incorrectly reject a score of exactly 60.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

const score = 72;

if (score >= 60) {
  console.log("Passed");
} else {
  console.log("Try again");
}
JS #03

A for loop and a running total

Loop from 1 through 5, add the values into sum, and print 15 at the end.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

Create the accumulator before the loop, then add the current i on every iteration. i <= 5 includes 5, so the final sum is 1 + 2 + 3 + 4 + 5.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

let sum = 0;

for (let i = 1; i <= 5; i++) {
  sum += i;
}

console.log(sum);
JS #04

Arrays: filter and map

Keep prices above 10, increase each by 10%, and store the result in discounted (the name is just a label; values increase).

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS #05

Objects and updating a property

Create a product object with a name and price. Increase the price by 5 and print the new value.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS #06

A function with an early return

Write formatName(name): trim surrounding spaces. Return Guest if the result is empty; otherwise return the name.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Intermediate #07

A cart total with reduce

Calculate the cart total from item prices and quantities. Use reduce with an initial value of 0.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Advanced #08

Closures: independent counters

Create makeCounter() to return a function. Each call should increment its own counter.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Advanced #09

Parallel work with Promise.all

Call loadProfile() and loadOrders() in parallel, await both, and print the order count.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Practice #10

Safe access with ?. and ??

A user may have no profile or city. Read the city and fall back to Unknown when missing.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Practice #11

Numeric sorting

Sort scores numerically in ascending order. Use toSorted to keep the original array unchanged.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Practice #12

Destructure settings

Read name and theme from settings, defaulting theme to light.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Advanced #13

Recursive countdown

Print from n down to 1 and stop. Include a base case.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
JS Advanced #14

The first result with Promise.race

Start two operations and use the result of whichever settles first.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY #15

Functions and return

Write total(price, quantity) to return an order total. Four items at 7.5 each should produce 30.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

The parameters receive values when the function is called. return passes a value back to the caller, which can store or print it. Calling the function does not print by itself.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

def total(price, quantity):
    return price * quantity

print(total(7.5, 4))
PY #16

Checking a condition with if / else

Set score to 72. Print Passed when it is at least 60; otherwise print Try again.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

Python uses a colon after the condition and indentation for the branch body. >= includes the boundary value 60. Use consistent indentation, commonly four spaces per level.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

score = 72

if score >= 60:
    print("Passed")
else:
    print("Try again")
PY #17

A for loop and range

Use a loop to add the numbers 1 through 5. Store the sum in total and print it.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

range(1, 6) includes 1 but excludes 6, so the loop runs five times. Initialize the accumulator before the loop, then add each value. Using range(1, 5) would omit 5.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

total = 0

for number in range(1, 6):
    total += number

print(total)
PY #18

Lists: filtering and transforming

Select values above 10 from prices, multiply each by 1.1, and store them in updated.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY #19

Dictionaries and lookup by key

Create a student dictionary with a name and score. Add 5 points and print the score.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY #20

Handling a numeric conversion error

Convert the string "42" to an integer and print it. Handle the case where the string is not numeric.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY #21

A function that validates input

Write greeting(name): trim surrounding spaces and return Hello, Guest for an empty name; otherwise greet the name.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Practice #22

Index and value with enumerate

Print each task with a human-friendly number starting at 1. Use enumerate instead of a manual counter.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Intermediate #23

Unique items while preserving order

Remove duplicate tags while preserving the order of first occurrence.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Practice #24

Pairing lists with zip

Pair names and scores by position. Strict mode should report if the lists have different lengths.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Intermediate #25

Files with pathlib

Create notes/today.txt, make its parent directory if needed, and write UTF-8 text.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Intermediate #26

Sort records by multiple fields

Sort products by price, then by name using a tuple key.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Intermediate #27

A task as a dataclass

Model Task with a required title, done=False, and a method that marks it complete.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Advanced #28

An even-number generator

Create a generator that yields even numbers below limit without an intermediate list.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PY Advanced #29

Read a file with a context manager

Open a UTF-8 text file with with, read it, and print its contents.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP #30

Functions, types, and return

Write total(float $price, int $quantity): float to return the order total. Four items at 7.5 each cost 30.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

Parameter types document the expected inputs; : float declares the result type. return ends the function and passes a value to its caller. Returning a value is easier to test and reuse than printing inside the function.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

<?php

declare(strict_types=1);

function total(float $price, int $quantity): float
{
    return $price * $quantity;
}

echo total(7.5, 4);
PHP #31

An if / else check

Set $score = 72. Print Passed when the score is at least 60; otherwise print Try again.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

>= includes the boundary value. Braces delimit each branch, while indentation makes the structure easier to read. This example uses echo; in an HTML response, escape untrusted input before output.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

<?php

$score = 72;

if ($score >= 60) {
    echo "Passed";
} else {
    echo "Try again";
}
PHP #32

foreach and a running total

Add the numbers in $prices, store the result in $total, and print the total.

Structure check: code is not run in the browser.

Step-by-step explanation and sample solution

foreach visits each array value. The accumulator starts at zero and is updated on every iteration. An empty array correctly leaves the sum at zero.

Hint: Implement the smallest step first, then check boundaries and call the function with an example.

<?php

$prices = [8, 12, 20];
$total = 0;

foreach ($prices as $price) {
    $total += $price;
}

echo $total;
PHP #33

Associative arrays

Create $product with name and price keys. Increase the price by 5 and print the new value.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP #34

Filtering with array_filter

Keep scores of 60 or higher from $scores and store them in $passed.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP #35

String validation and early return

Write displayName(string $name): string: trim surrounding spaces and return Guest if the string is empty.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP #36

PDO and a prepared query

Prepare a user lookup by email with a :email placeholder. Bind the address separately; do not concatenate it into SQL.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Practice #37

Fallback values with ??

Read nickname from a user array. Use Guest when missing or null, but preserve an empty string.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Intermediate #38

Order status with match

Map new, shipped, and cancelled states to messages. Return Unknown for an unrecognized state.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Advanced #39

Store passwords as hashes

Hash a password with password_hash and verify input with password_verify. Do not compare the raw password to the hash.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Intermediate #40

Immutable delivery dates

Create a date and get a new object three days later while keeping the original unchanged.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Practice #41

Validate an email with filter_var

Validate an email with FILTER_VALIDATE_EMAIL. Show an error and stop processing when it is invalid.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Practice #42

Transform prices with array_map

Increase every price by 5% in a new array without changing the original.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Intermediate #43

Extract a field and sort it

Extract product names and sort them naturally without case sensitivity.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in
PHP Advanced #44

Decode JSON with an exception

Decode JSON with JSON_THROW_ON_ERROR. Catch JsonException and show a clear error.

🔒 This exercise unlocks after free sign-up, along with all course exercises and lessons.

Create account Log in

No exercises match this filter.

Regex Studio — regular expression practice

Choose a challenge, write a pattern, and explore matches with JavaScript, Python, and PHP examples.

0

How are these videos built?

Code, line by line

At every step the running line lights up, with a plain-language explanation of what just happened right next to it.

Memory and the stack, visible

Variables, arrays, function calls, and the event loop — everything a textbook can't show you is visible in the animation.

One topic — in 3 languages

Compare the same topic in JavaScript, Python, and PHP. Every example is real code, actually run and verified.

WhatsApp