Check a device list with a script
Check five made-up device records. Report which pass the rules, which fail, and which have missing or wrong information.
Get the files
You need: A text editor and a programming language you know. You can check the rows on paper first.
This checks made-up records. It does not connect to or change real devices.
Open the files
- Find device-check-report.zip in your Downloads folder.
- On Windows, right-click the ZIP and choose Extract All to unpack the files.
- Open the extracted folder, then open the device-check-report folder inside it.
- Right-click README.md, choose Open with, and select a text editor such as Notepad.
- Open rules.md in the text editor and devices.csv in a spreadsheet or text editor.
A CSV file is a table. The optional example checker uses Python 3; you can write your own in another language.
Do the project
- Check each of the five rows by hand using the rules in order.
- Write a script that reports the device number, PASS, FAIL, or INVALID, and the reason. FAIL means a valid record fails the backup rule. INVALID means the information cannot be checked as given.
- Compare your report with expected-results.csv. Try missing-column.csv too. Check that your script left the original files unchanged.
Check your work
Check devices.csv.
DEV-001 passes. DEV-002 and DEV-004 fail the backup rule. DEV-003 and DEV-005 have invalid information.
Check missing-column.csv.
Report the missing backup_state column. Do not mark the file as passing.
Run your script twice on the same files.
Both reports give the same results, and the original files stay unchanged.
Keep your work
- Your script
- Your results beside the supplied answers
- A check that the original files did not change, plus a note about what was not tested
Extra practice and separate files
Count the PASS, FAIL, and INVALID rows, or save the report as JSON. Keep FAIL and INVALID separate, and do not let the script change the original data.
Download one file
All of these files are also in the ZIP download above.