Lab 1 of 5
Β·
Open-Ended
Write device.py β The NetworkDevice Class
Objective: Write device.py with a NetworkDevice class that has get_summary() and to_dict() methods.
Instructions
Create a directory called capstone/ and inside it create device.py.
Write the NetworkDevice class from scratch. It must:
- Store five attributes:
name,ip,device_type,site,vlan - Have a
get_summary()method with a one-line docstring that returns a formatted one-line description of the device - Have a
to_dict()method with a one-line docstring that returns a dictionary with keys:name,ip,type,site,vlan
Do not copy from the lesson β write it yourself using what you learned in Unit 9.
Paste your completed device.py below and submit.
π‘ Show Hint
You wrote NetworkDevice in Unit 9. The only new requirement is to_dict() β it returns a plain dict with keys matching the exact names listed above. Both methods need a one-line docstring inside the function body.
Submit Your Code