// resources
Resources
All
|
Cheatsheet
Code Example
Exercise
Template
Other
Achievement
|
Basics
Control Flow
Functions
Data Structures
Modules & Packages
Projects
Object-oriented programming
|
↑ oldest first
↓ newest first
// Exercise
even_numbers_2.py
Even Numbers upgraded — get_even() rewritten as a list comprehension. Four lines became one. Same result, less code.
// Code Example
file_reading.py
read(), readlines(), readline(), and looping directly — every way Python reads a file. Place soldiers.txt in the same f…
// Other
soldiers.txt
Test file for the file reading examples. Download and place it in the same folder as your script.
// 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 …
// Code Example
file_csv.py
CSV files — reader, DictReader, writer, DictWriter. Every pattern in one place. All values are strings — convert when n…
// Other
soldiers.csv
Test file for the CSV examples. Download and place it in the same folder as your script.
// Exercise
daily_notes.py
Daily Notes — write a note, save it with a timestamp, append forever. Run it tomorrow and everything's still there.
// Exercise
shopping_list_3.py
Shopping List v3 — the list now survives. Saves to CSV on quit, loads on start. Run it tomorrow and everything's still …
// Other
file_mistakes.py
7 mistakes almost every beginner makes with file handling. Wrong way, error, right way — all in one file.
// Cheatsheet
File Handling — The Full Picture
Everything you've learned about file handling — in one place. The pattern, modes, reading, writing, CSV, error handling…
// Code Example
module_datetime.py
datetime, date, timedelta — current time, formatting with strftime, parsing with strptime, and calculating differences …
// Code Example
module_statistics.py
statistics — mean, median, mode, multimode, stdev. Five lines and a complete picture of your data.
// Code Example
module_time.py
time — sleep, time(), perf_counter. Pause execution, measure elapsed time, and build a countdown. Two functions that co…
// Code Example
module_collections.py
Counter and defaultdict — two tools that eliminate boilerplate. Count occurrences in one line, group items without chec…
// Code Example
module_string.py
Built-in string constants — ascii_letters, digits, punctuation. Check membership, generate passwords, validate input, s…