⚑ IT Wisdom How many DevOps engineers does it take to change a lightbulb? All of them. One to change it, the rest to argue about whether to containerize it first.
Skilled Practitioner
4249 XP 1751 to Expert
Objective: Write a formatted status report to a text file then read it back and print it.
Instructions

Create a file called lab2.py. Write a script that:

  1. Writes a device status report to status_report.txt
  2. Reads the file back and prints every line

Use this device data:

devices = [
    {"name": "sw-core-01",  "status": "online"},
    {"name": "sw-access-01","status": "offline"},
    {"name": "rtr-edge-01", "status": "online"},
]

Your output must match exactly:

Report written to status_report.txt
Device Status Report
=========================
sw-core-01 β€” online
sw-access-01 β€” offline
rtr-edge-01 β€” online

Run it with python3 lab2.py. Paste your output below and submit.

πŸ’‘ Show Hint
Write to the file using f.write(). After writing, print "Report written..." then open and read the file back with a second "with open" block, printing each line with strip().
Paste Your Output
Next Lab β†’