Browse by category
Clean, runnable Python snippets organized by topic. Pick a category, copy the code, or load it straight into the Playground.
Basics
Variables, printing, input, and arithmetic.
5 examples
Loops
for, while, range, break, and continue.
5 examples
Functions
Definitions, arguments, returns, and lambdas.
6 examples
Lists
Creating, indexing, slicing, and comprehensions.
5 examples
Strings
Slicing, methods, formatting, and searching.
5 examples
Dictionaries
Key/value pairs, iteration, and updates.
5 examples
OOP
Classes, inheritance, and special methods.
5 examples
Tuples & Sets
Immutable sequences and unique collections.
4 examples
Files & Errors
Reading, writing, and exception handling.
4 examples