← Theory library
Python theory
Scripting, data and web3.py — runs for real via Pyodide.
Practise in the Code Lab →Easy
- 1. What Python isA dynamically typed, interpreted language with readable syntax.
- 2. Variables and dynamic typingNames are bound to objects; types are checked at runtime.
- 3. Numbers and arithmeticint, float, and Python's exact division operators.
- 4. StringsImmutable text sequences with rich formatting.
- 5. ListsOrdered, mutable sequences.
- 6. Tuples and immutabilityFixed-size, immutable sequences good for records.
- 7. DictionariesKey-value mappings, insertion-ordered since 3.7.
- 8. SetsUnordered collections of unique, hashable items.
- 9. Control flow: if/elif/elseBranching based on truthy conditions.
- 10. for loops and rangeIterating over sequences and iterables.
- 11. while loops and control statementsLooping until a condition changes; break and continue.
- 12. Functions and default argumentsdef, parameters, defaults, and return values.
- 13. *args and **kwargsVariadic positional and keyword parameters.
- 14. Lambda expressionsAnonymous single-expression functions.
- 15. Exceptionstry/except/else/finally for handling errors.
- 16. Modules and the standard libraryimport, from...import, and useful stdlib modules.
- 17. File-like data with jsonSerializing Python data to and from JSON text.
- 18. String formatting and parsingf-strings, .format(), split/join, and number bases.
- 19. Classes and objectsDefining classes with __init__ and methods.
- 20. List, dict, and set comprehensionsConcise syntax for building collections from iterables.
Medium
- 21. Iterators and generatorsyield, lazy evaluation, and the iterator protocol.
- 22. DecoratorsFunctions that wrap other functions to add behavior.
- 23. Context managers and `with`Deterministic setup/teardown using with statements.
- 24. Inheritance and polymorphismSubclassing, method overriding, and super().
- 25. DataclassesBoilerplate-free classes for structured data.
- 26. Type hintsOptional static type annotations checked by external tools.
- 27. Regular expressionsPattern matching text with the re module.
- 28. Working with dates and timesThe datetime module for timestamps and durations.
- 29. Collections module: Counter, defaultdict, dequeSpecialized container types beyond the built-ins.
- 30. Sorting and key functionssorted(), .sort(), and custom comparison keys.
- 31. Working with JSON APIs (parsing, validation)Structuring and validating data coming from RPC responses.
- 32. Hashing with hashlibComputing cryptographic hashes for integrity and addresses.
- 33. Working with bytes and encodingbytes vs str, hex encoding, and base64.
- 34. Unit testing with unittest/assertWriting checkable assertions and simple test functions.
- 35. Working with CSV and structured textReading/writing tabular data with the csv module.
- 36. Working with argparse-style scripts (mocked)Structuring reusable, testable script logic.
- 37. Iterables, `itertools`, and functional helpersmap, filter, reduce, and itertools building blocks.
Hard
- 38. Concurrency: threading vs multiprocessingThe GIL, threads for I/O-bound work, processes for CPU-bound work.
- 39. Async/await with asyncioCooperative concurrency for I/O-bound code.
- 40. Structuring larger programs: packages and __init__.pyOrganizing modules into packages.
- 41. Operator overloading and dunder methodsCustomizing how objects respond to +, ==, len(), etc.
- 42. Working with abstract base classes and protocolsDefining interfaces with abc and structural typing.
- 43. Memory model: mutability, references, and copyShared references, shallow vs deep copy.
- 44. Performance: profiling and complexity awarenessMeasuring instead of guessing; common complexity traps.
- 45. Building a small CLI-style calculator (design)Composing functions, validation, and error handling.
- 46. Simulating a token ledger (design)Modeling balances, transfers, and invariants with plain Python.
- 47. Parsing and validating on-chain-style event logsStructuring and filtering a list of event dictionaries.
- 48. Merkle trees in pure PythonBuilding a simple Merkle root from leaf hashes.
- 49. Building a mini virtual machine / interpreterExecuting a tiny stack-based instruction set in Python.
- 50. Capstone: designing a small analytics toolCombining parsing, aggregation, and reporting into one cohesive script.