We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Everyday Standard Library Tools
PythonCount, group and queue data with collections and heapq, stream it with generators and itertools, and cache results with functools. Clean up with contextlib, and handle paths, enums, TOML config and time zones.
This track uses Python. You can make it your practice mode to browse related content across the site.
Your learning sequence
- 1 Count Repeated Values with Counter Read
- 2 Not solved yet. Count N-Grams and Break Ties with Counter Practice · Easy
- 3 Handle Missing Keys with get, setdefault and defaultdict Read
- 4 Not solved yet. Group Rows by Key and Return a Plain dict Practice · Easy
- 5 Queues and Sliding Windows with deque Read
- 6 Not solved yet. Compute a Rolling Median with a Bounded deque Practice · Medium
- 7 Priority Queues, Sorted Lists and Summary Statistics Read
- 8 Not solved yet. Build a Task Queue That Keeps Arrival Order for Ties Practice · Medium
- 9 Layer Configuration with ChainMap Read
- 10 Not solved yet. Resolve a Setting and Report the Layer It Came From Practice · Medium
- 11 When to Use OrderedDict Instead of dict Read
- 12 Generators and One-Shot Iterators Read
- 13 Not solved yet. Find the First Error with a Generator Practice · Easy
- 14 Take the First Few Items with chain and islice Read
- 15 Not solved yet. Take n Items Across Chunks Without Reading Ahead Practice · Easy
- 16 Group Adjacent Items with groupby Read
- 17 Not solved yet. Count and Total Rows per Key with groupby Practice · Medium
- 18 Split a Stream into Batches with batched Read
- 19 Not solved yet. Page Records and Check the Size at Call Time Practice · Easy
- 20 Adjacent Pairs and Running Totals with pairwise and accumulate Read
- 21 Not solved yet. Find the Largest Drop from a Running Peak Practice · Easy
- 22 Split an Iterator with tee and Combine Inputs with product Read
- 23 Repeat, Pad and Filter Streams with itertools Read
- 24 Reuse Earlier Results with cache and lru_cache Read
- 25 Not solved yet. Speed Up Edit Distance with a Cached Helper Practice · Medium
- 26 Cache Method Results Without Keeping Objects Alive Read
- 27 Not solved yet. Give Each Object Its Own Cache Practice · Medium
- 28 Compute an Attribute Once with cached_property Read
- 29 Not solved yet. Cache a Report Total Until You Clear It Practice · Medium
- 30 Choose a Function by Argument Type with singledispatch Read
- 31 Not solved yet. Build a JSON Converter Other Code Can Extend Practice · Hard
- 32 Write Typed Decorators with wraps and ParamSpec Read
- 33 Preset Arguments with partial and partialmethod Read
- 34 Not solved yet. Retry a Flaky Call and Preset Arguments with partial Practice · Medium
- 35 Combine a List into One Value with reduce Read
- 36 Make Objects Sortable with total_ordering Read
- 37 Not solved yet. Sort Version Strings with Pre-Releases First Practice · Medium
- 38 Write a Context Manager with a Generator Read
- 39 Not solved yet. Change an Attribute for One Block and Put It Back Practice · Medium
- 40 Clean Up Any Number of Resources with ExitStack Read
- 41 Not solved yet. Open a List of Resources and Close Them All Practice · Hard
- 42 Small contextlib Helpers for Cleanup and Expected Errors Read
- 43 Not solved yet. Close a Stream Only If You Opened It Practice · Easy
- 44 Join Paths Safely with pathlib Read
- 45 Not solved yet. Keep a Joined Path Inside Its Root Folder Practice · Easy
- 46 Walk a Directory Tree and Skip Folders Read
- 47 Not solved yet. Find Large Files Without Entering Skipped Folders Practice · Medium
- 48 Replace String Constants with StrEnum Read
- 49 Not solved yet. Migrate a Status Enum to StrEnum Practice · Medium
- 50 Combine Permission Bits with Flag Read
- 51 Not solved yet. Decode a Three-Bit Permission Mask Practice · Medium
- 52 Read and Check a TOML Config File Read
- 53 Not solved yet. Load a Server Config and Report the First Bad Setting Practice · Medium
- 54 Store Times in UTC and Schedule in Local Time Read
- 55 Not solved yet. Find the Next Daily Run in a Time Zone Practice · Hard
Check yourself
11 questions · not saved while you're signed outUse these questions to check your understanding and compare explanations. Your score does not affect track completion.
For this plain Enum, what do the two comparisons print?
Choose one answer to reveal the explanations. Answers are kept only while this page is open.
from enum import Enum
class Col(Enum):
R = 1
print(Col.R is Col(1))
print(Col.R == 1)