#๐ Files and Import
6 messages ยท Page 1 of 1 (latest)
@fossil hawk
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
PROBLEM: Provide persistence to the simple inventory management system for chemical storage
With the inventory management system deployed and implemented in the laboratory, the laboratory manager now requests for the data to be persistent beyond the execution of the program. You will be using files to do this.
Requirements
For this problem, you need to be able to do the following in addition to the previous functionalities:
Load Inventory
Save Inventory
As such, your Python program should:
Have a function, loadInventory, which accepts an input dictionary, that performs a load operation on a file called inventory.dat
Have a function, saveInventory, which accepts an input dictionary, that performs a save operation of your inventory on a file called inventory.dat
These new functions AND the old ones must be written on a separate file as indicated in the instructions. Consequently, the module must also be imported to your main file as well.
File Format
Your inventory.dat should follow the following format:
<stock_code_01>,<chem_name_01>,<chem_amount_01>,<chem_expiry_01>,<chem_storage_01>
<stock_code_02>,<chem_name_02>,<chem_amount_02>,<chem_expiry_02>,<chem_storage_02>
...
<stock_code_n>,<chem_name_n>,<chem_amount_n>,<chem_expiry_n>,<chem_storage_n>
Notes
n is the number of products.
Each piece of information is separated by a comma.
Assume that inventory.dat will always exist.
Assume that inventory.dat will always follow the format described above.
what do you have so far?
bro wants us to do his homework
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.