Python Lesson 7: Reading and Writing Files
Read and write CSV files with Python’s standard library: open with a with-block, csv.DictReader, totals with defaultdict, writing a result file, encodings, and file paths.
Read article →Read and write CSV files with Python’s standard library: open with a with-block, csv.DictReader, totals with defaultdict, writing a result file, encodings, and file paths.
Read article →Write your own reusable functions with def: parameters, default values, return, docstrings, and practical examples like GST, financial-year labels and grading — Python’s version of LAMBDA.
Read article →Repeat work with for loops over lists, dictionaries and ranges, count and total inside loops, list comprehensions, while loops, and break/continue — the code version of filling a formula down.
Read article →Hold many values with lists (indexing, append, sort, slices) and look things up with dictionaries (keys, get, items) — Python’s versions of a column and a lookup table.
Read article →Make decisions in Python: comparisons, if/elif/else blocks and indentation, and/or/not, one-line conditional expressions, and the IF patterns from Excel translated to Python.
Read article →Store values in variables, use int, float, str and bool, do maths with rounding, format output with f-strings including thousands separators, and convert between text and numbers.
Read article →Install Python on Windows the right way, use VS Code or IDLE, run a script from the terminal, use the interactive prompt, and install packages with pip.
Read article →Maths & trigLevel: ExpertAvailable in: Excel 2007+SUMX2PY2 returns Σ(x² + y²).Syntax=SUMX2PY2(array_x, array_y)ArgumentWhat it meansarray_x.
Read article →Track receivables in Excel: outstanding per invoice, days past due from the due date, ageing buckets, customer-wise outstanding, collection efficiency and a DSO estimate, plus a follow-up list.
Read article →Build a receivables ageing report in Excel: days overdue from the due date, bucket labels, SUMIFS totals by bucket and customer, a pivot version, and the mistakes that misstate overdue amounts.
Read article →Maths & trigLevel: ExpertAvailable in: Excel 2007+SUMX2MY2 returns Σ(x² - y²) for two matching ranges.Syntax=SUMX2MY2(array_x, array_y)ArgumentWhat it.
Read article →Exact age or service tenure as "5 years 3 months 12 days", completed years for gratuity, age on a specific date, decimal years with YEARFRAC, and the DATEDIF quirks that give wrong answers.
Read article →