A text file is already created called devices.txt contains a list of devices called device 1, device 2, and device 3 In the main function, create a main menu for the end user to select from different options: OUTPUT EXAMPLE Welcome to the Device Management System 1. view all devices 2. add a device 3. delete a device 4. update a device 5. exit the program Select one option from the list ( 1, 2, 3,4 or 5 ): 2 Add the device: device 4 device 4 is added Do you want to continue?(y/n):y [the devices.txt should be updated as well] device.txt device 1 device 2 device 3 device 4 ____________________________________________________________________________________- if option 1 is selected it should output the contents of of device.txt if option 2 is selcted it should add a device to device.txt if option 3 is selcted it should remove a device from device.txt if option 4 is selcted the update function updates the name of a device when the user enters the device code. then the updated list of devices is written back to the file. if option 5 is selected, the program should stop running. If an invalid option is inputed, the program will output "error" The program should continue until the user input is 5 from the menu to exit the program or 'n' when asked if they want to continue. ALL OPTIONS MUST BE CODED IN THEIR OWN FUNCTION TO BE CALLED LATER IN MAIN
PYTHON PLEASE
A text file is already created called devices.txt contains a list of devices called device 1, device 2, and device 3
In the main function, create a main menu for the end user to select from different options:
OUTPUT EXAMPLE
Welcome to the Device Management System
1. view all devices
2. add a device
3. delete a device
4. update a device
5. exit the program
Select one option from the list ( 1, 2, 3,4 or 5 ): 2
Add the device: device 4
device 4 is added
Do you want to continue?(y/n):y
[the devices.txt should be updated as well]
device.txt
device 1
device 2
device 3
device 4
____________________________________________________________________________________-
if option 1 is selected it should output the contents of of device.txt
if option 2 is selcted it should add a device to device.txt
if option 3 is selcted it should remove a device from device.txt
if option 4 is selcted the update function updates the name of a device when the user enters the device code. then the updated list of devices is written back to the file.
if option 5 is selected, the program should stop running.
If an invalid option is inputed, the program will output "error"
The program should continue until the user input is 5 from the menu to exit the program or 'n' when asked if they want to continue.
ALL OPTIONS MUST BE CODED IN THEIR OWN FUNCTION TO BE CALLED LATER IN MAIN
Step by step
Solved in 2 steps with 4 images