Home / Learning guides / Python
The practice notebook · Kalyan

A Python CSV Validation Project for Kalyan Beginners

Build a small validator that reports bad rows clearly instead of silently dropping them.

Python IT Accurate · 30 October 2026 · 3 minute read

Choose an input contract

Use a fictional library-loan file with loan_id, book_id, borrowed_on and returned_on columns. State which fields are required, the date format and whether an empty return date means the book is still on loan. Write these rules before coding. Otherwise, different rows may be treated differently without a clear reason.

Read records with a CSV parser

Python’s csv module supports reading and writing tabular CSV data. Use a parser instead of splitting every line on commas, because quoted fields can contain commas themselves. Begin by checking the header names. Keep the original input separate from any output and make the program’s behaviour predictable when a file is missing or unreadable.

Report problems with context

Prepare four deliberate faults: a missing loan ID, a repeated loan ID, an invalid date and a return date earlier than the borrowing date. For each rejected row, produce the source row number and a short reason. Keep missing values distinct from zero or an empty result. Do not silently repair an ambiguous date; record it for review.

Make the result reproducible

Produce a clean output file, an exceptions file and a summary with input, accepted and rejected row counts. Check that the counts reconcile. Run the same input twice and confirm that outputs do not accumulate duplicate rows. Kalyan learners can bring this exercise to a Python course discussion and ask about file handling, functions, debugging and feedback on practical assignments. Confirm the batch level before enrolling.

Your practice checklist

  • Required columns and date rules documented.
  • Quoted CSV values handled.
  • Rejected rows retain a reason.
  • Input and output counts reconcile.

Further reading: Official technical guidance. The fictional exercises and checklists above are IT Accurate learning examples.

← Explore more learning guides · Visit our Kalyan centre page