// resources

Resources

// Code Example
dict_creation.py
Dict creation — literals, empty dicts, keyword arguments, zip from two lists, and adding keys one at a time. Every way …
[ download ]
// Code Example
dict_reading.py
Reading from a dict — square brackets, get(), default values, and keys/values/items views. Direct when certain, safe wh…
17 downloads 06 May 2026 → How to Ask a Dict for What You Need
[ download ]
// Code Example
dict_modifying.py
Modifying a dict — direct assignment, update, setdefault, pop, popitem, clear. Methods that write, and the one mistake …
16 downloads 06 May 2026 → How to Modify a Dict
[ download ]
// Code Example
dict_inspection.py
Getting information from a dict — in, len, keys, values, items, copy. Reading without changing, and the copy trap that …
16 downloads 06 May 2026 → Getting Information From a Dict
[ download ]
// Code Example
dict_iteration.py
Iterating over a dict — keys, values, and pairs. The three patterns, when to use each, and how to build a new dict from…
16 downloads 06 May 2026 → Going Through Every Key and Value
[ download ]
// Code Example
dict_nested.py
Nested dicts — one structure, all the data. Creating, accessing with two keys, looping with items(), modifying inner di…
[ download ]
// Code Example
tuple_usage.py
Tuples in practice — indexing, slicing, looping, unpacking, multiple return values, dict keys, and converting between t…
16 downloads 06 May 2026 → Using Tuples in Your Code
[ download ]
// Code Example
set_usage.py
Sets in practice — add, remove, discard, membership checking, union, intersection, difference, and the patterns that ma…
16 downloads 06 May 2026 → Using Sets in Your Code
[ download ]
// Code Example
list_set_comprehensions.py
List and set comprehensions — transform, filter, and deduplicate in one line. Square brackets for lists, curly braces f…
[ download ]
// Code Example
dict_comprehensions.py
Dict comprehensions — build from a list, transform an existing dict, filter key-value pairs, swap keys and values, and …
16 downloads 06 May 2026 → Building Dicts the Short Way
[ download ]
// Code Example
file_reading.py
read(), readlines(), readline(), and looping directly — every way Python reads a file. Place soldiers.txt in the same f…
16 downloads 06 May 2026 → How Python Reads a File
[ download ]
// Code Example
file_writing.py
Write, overwrite, append — every output pattern in one place. "w" starts fresh, "a" adds to the end, and write() needs …
[ download ]
// Code Example
file_csv.py
CSV files — reader, DictReader, writer, DictWriter. Every pattern in one place. All values are strings — convert when n…
[ download ]
// Code Example
module_datetime.py
datetime, date, timedelta — current time, formatting with strftime, parsing with strptime, and calculating differences …
[ download ]
// Code Example
module_statistics.py
statistics — mean, median, mode, multimode, stdev. Five lines and a complete picture of your data.
[ download ]