Construction workers need tools to work. They borrow tools from the Tool Store.
The available tools are:
A program is required to allow a worker to borrow a tool.
All available tools are stored in an array eg:
toolStore = ["hammer", "glue gun", "tape measure", "taken", "brush", "brush", "taken", "brush"]
To borrow a tool, the worker has to enter the type of tool needed into a computer program eg:
tool = input("What kind of tool would you like to borrow?")
The program searches the array for the tool. If it is available, it is replaced by the word "taken" and a message appears Please take your tool.
Note - only 1 tool can be taken at a time!
Otherwise a message Tool unavailable is displayed and the user is prompted to enter the name of another tool.
Design a program that will allow worker's to borrow tools from the tool store.
Adapt your program so that it offers a choice of:
If the user chooses 1, the program works as before.
If the user chooses 2, if there is a "taken" in the Tool Store array, the user is asked which tool is being returned and it is placed in the tool box, replacing "taken".
The menu then reappears and the worker can repeat the process.
Design this adaptation.
Are there any opportunities to include validation checks in these coding assignments?
Make sure you test your code with a variety of data to make sure it works as expected.